
obj/user/faultdie.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 57 00 00 00       	call   800088 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <handler>:

#include <inc/lib.h>

void
handler(struct UTrapframe *utf)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	83 ec 0c             	sub    $0xc,%esp
  80003d:	8b 55 08             	mov    0x8(%ebp),%edx
	void *addr = (void*)utf->utf_fault_va;
	uint32_t err = utf->utf_err;
	cprintf("i faulted at va %x, err %x\n", addr, err & 7);
  800040:	8b 42 04             	mov    0x4(%edx),%eax
  800043:	83 e0 07             	and    $0x7,%eax
  800046:	50                   	push   %eax
  800047:	ff 32                	pushl  (%edx)
  800049:	68 c0 1f 80 00       	push   $0x801fc0
  80004e:	e8 44 01 00 00       	call   800197 <cprintf>
	sys_env_destroy(sys_getenvid());
  800053:	e8 14 0b 00 00       	call   800b6c <sys_getenvid>
  800058:	89 04 24             	mov    %eax,(%esp)
  80005b:	e8 c7 0a 00 00       	call   800b27 <sys_env_destroy>
}
  800060:	83 c4 10             	add    $0x10,%esp
  800063:	c9                   	leave  
  800064:	c3                   	ret    

00800065 <umain>:

void
umain(int argc, char **argv)
{
  800065:	f3 0f 1e fb          	endbr32 
  800069:	55                   	push   %ebp
  80006a:	89 e5                	mov    %esp,%ebp
  80006c:	83 ec 14             	sub    $0x14,%esp
	set_pgfault_handler(handler);
  80006f:	68 33 00 80 00       	push   $0x800033
  800074:	e8 4a 0d 00 00       	call   800dc3 <set_pgfault_handler>
	*(int*)0xDeadBeef = 0;
  800079:	c7 05 ef be ad de 00 	movl   $0x0,0xdeadbeef
  800080:	00 00 00 
}
  800083:	83 c4 10             	add    $0x10,%esp
  800086:	c9                   	leave  
  800087:	c3                   	ret    

00800088 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  800088:	f3 0f 1e fb          	endbr32 
  80008c:	55                   	push   %ebp
  80008d:	89 e5                	mov    %esp,%ebp
  80008f:	56                   	push   %esi
  800090:	53                   	push   %ebx
  800091:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800094:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800097:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  80009e:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8000a1:	e8 c6 0a 00 00       	call   800b6c <sys_getenvid>
  8000a6:	25 ff 03 00 00       	and    $0x3ff,%eax
  8000ab:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8000ae:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8000b3:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8000b8:	85 db                	test   %ebx,%ebx
  8000ba:	7e 07                	jle    8000c3 <libmain+0x3b>
		binaryname = argv[0];
  8000bc:	8b 06                	mov    (%esi),%eax
  8000be:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  8000c3:	83 ec 08             	sub    $0x8,%esp
  8000c6:	56                   	push   %esi
  8000c7:	53                   	push   %ebx
  8000c8:	e8 98 ff ff ff       	call   800065 <umain>

	// exit gracefully
	exit();
  8000cd:	e8 0a 00 00 00       	call   8000dc <exit>
}
  8000d2:	83 c4 10             	add    $0x10,%esp
  8000d5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8000d8:	5b                   	pop    %ebx
  8000d9:	5e                   	pop    %esi
  8000da:	5d                   	pop    %ebp
  8000db:	c3                   	ret    

008000dc <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8000dc:	f3 0f 1e fb          	endbr32 
  8000e0:	55                   	push   %ebp
  8000e1:	89 e5                	mov    %esp,%ebp
  8000e3:	83 ec 08             	sub    $0x8,%esp
	close_all();
  8000e6:	e8 68 0f 00 00       	call   801053 <close_all>
	sys_env_destroy(0);
  8000eb:	83 ec 0c             	sub    $0xc,%esp
  8000ee:	6a 00                	push   $0x0
  8000f0:	e8 32 0a 00 00       	call   800b27 <sys_env_destroy>
}
  8000f5:	83 c4 10             	add    $0x10,%esp
  8000f8:	c9                   	leave  
  8000f9:	c3                   	ret    

008000fa <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  8000fa:	f3 0f 1e fb          	endbr32 
  8000fe:	55                   	push   %ebp
  8000ff:	89 e5                	mov    %esp,%ebp
  800101:	53                   	push   %ebx
  800102:	83 ec 04             	sub    $0x4,%esp
  800105:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800108:	8b 13                	mov    (%ebx),%edx
  80010a:	8d 42 01             	lea    0x1(%edx),%eax
  80010d:	89 03                	mov    %eax,(%ebx)
  80010f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800112:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800116:	3d ff 00 00 00       	cmp    $0xff,%eax
  80011b:	74 09                	je     800126 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80011d:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800121:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800124:	c9                   	leave  
  800125:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800126:	83 ec 08             	sub    $0x8,%esp
  800129:	68 ff 00 00 00       	push   $0xff
  80012e:	8d 43 08             	lea    0x8(%ebx),%eax
  800131:	50                   	push   %eax
  800132:	e8 ab 09 00 00       	call   800ae2 <sys_cputs>
		b->idx = 0;
  800137:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80013d:	83 c4 10             	add    $0x10,%esp
  800140:	eb db                	jmp    80011d <putch+0x23>

00800142 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800142:	f3 0f 1e fb          	endbr32 
  800146:	55                   	push   %ebp
  800147:	89 e5                	mov    %esp,%ebp
  800149:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80014f:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800156:	00 00 00 
	b.cnt = 0;
  800159:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800160:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800163:	ff 75 0c             	pushl  0xc(%ebp)
  800166:	ff 75 08             	pushl  0x8(%ebp)
  800169:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  80016f:	50                   	push   %eax
  800170:	68 fa 00 80 00       	push   $0x8000fa
  800175:	e8 20 01 00 00       	call   80029a <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80017a:	83 c4 08             	add    $0x8,%esp
  80017d:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800183:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800189:	50                   	push   %eax
  80018a:	e8 53 09 00 00       	call   800ae2 <sys_cputs>

	return b.cnt;
}
  80018f:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800195:	c9                   	leave  
  800196:	c3                   	ret    

00800197 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800197:	f3 0f 1e fb          	endbr32 
  80019b:	55                   	push   %ebp
  80019c:	89 e5                	mov    %esp,%ebp
  80019e:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8001a1:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8001a4:	50                   	push   %eax
  8001a5:	ff 75 08             	pushl  0x8(%ebp)
  8001a8:	e8 95 ff ff ff       	call   800142 <vcprintf>
	va_end(ap);

	return cnt;
}
  8001ad:	c9                   	leave  
  8001ae:	c3                   	ret    

008001af <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8001af:	55                   	push   %ebp
  8001b0:	89 e5                	mov    %esp,%ebp
  8001b2:	57                   	push   %edi
  8001b3:	56                   	push   %esi
  8001b4:	53                   	push   %ebx
  8001b5:	83 ec 1c             	sub    $0x1c,%esp
  8001b8:	89 c7                	mov    %eax,%edi
  8001ba:	89 d6                	mov    %edx,%esi
  8001bc:	8b 45 08             	mov    0x8(%ebp),%eax
  8001bf:	8b 55 0c             	mov    0xc(%ebp),%edx
  8001c2:	89 d1                	mov    %edx,%ecx
  8001c4:	89 c2                	mov    %eax,%edx
  8001c6:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8001c9:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8001cc:	8b 45 10             	mov    0x10(%ebp),%eax
  8001cf:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  8001d2:	89 45 e0             	mov    %eax,-0x20(%ebp)
  8001d5:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  8001dc:	39 c2                	cmp    %eax,%edx
  8001de:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  8001e1:	72 3e                	jb     800221 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  8001e3:	83 ec 0c             	sub    $0xc,%esp
  8001e6:	ff 75 18             	pushl  0x18(%ebp)
  8001e9:	83 eb 01             	sub    $0x1,%ebx
  8001ec:	53                   	push   %ebx
  8001ed:	50                   	push   %eax
  8001ee:	83 ec 08             	sub    $0x8,%esp
  8001f1:	ff 75 e4             	pushl  -0x1c(%ebp)
  8001f4:	ff 75 e0             	pushl  -0x20(%ebp)
  8001f7:	ff 75 dc             	pushl  -0x24(%ebp)
  8001fa:	ff 75 d8             	pushl  -0x28(%ebp)
  8001fd:	e8 4e 1b 00 00       	call   801d50 <__udivdi3>
  800202:	83 c4 18             	add    $0x18,%esp
  800205:	52                   	push   %edx
  800206:	50                   	push   %eax
  800207:	89 f2                	mov    %esi,%edx
  800209:	89 f8                	mov    %edi,%eax
  80020b:	e8 9f ff ff ff       	call   8001af <printnum>
  800210:	83 c4 20             	add    $0x20,%esp
  800213:	eb 13                	jmp    800228 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800215:	83 ec 08             	sub    $0x8,%esp
  800218:	56                   	push   %esi
  800219:	ff 75 18             	pushl  0x18(%ebp)
  80021c:	ff d7                	call   *%edi
  80021e:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800221:	83 eb 01             	sub    $0x1,%ebx
  800224:	85 db                	test   %ebx,%ebx
  800226:	7f ed                	jg     800215 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800228:	83 ec 08             	sub    $0x8,%esp
  80022b:	56                   	push   %esi
  80022c:	83 ec 04             	sub    $0x4,%esp
  80022f:	ff 75 e4             	pushl  -0x1c(%ebp)
  800232:	ff 75 e0             	pushl  -0x20(%ebp)
  800235:	ff 75 dc             	pushl  -0x24(%ebp)
  800238:	ff 75 d8             	pushl  -0x28(%ebp)
  80023b:	e8 20 1c 00 00       	call   801e60 <__umoddi3>
  800240:	83 c4 14             	add    $0x14,%esp
  800243:	0f be 80 e6 1f 80 00 	movsbl 0x801fe6(%eax),%eax
  80024a:	50                   	push   %eax
  80024b:	ff d7                	call   *%edi
}
  80024d:	83 c4 10             	add    $0x10,%esp
  800250:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800253:	5b                   	pop    %ebx
  800254:	5e                   	pop    %esi
  800255:	5f                   	pop    %edi
  800256:	5d                   	pop    %ebp
  800257:	c3                   	ret    

00800258 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800258:	f3 0f 1e fb          	endbr32 
  80025c:	55                   	push   %ebp
  80025d:	89 e5                	mov    %esp,%ebp
  80025f:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800262:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800266:	8b 10                	mov    (%eax),%edx
  800268:	3b 50 04             	cmp    0x4(%eax),%edx
  80026b:	73 0a                	jae    800277 <sprintputch+0x1f>
		*b->buf++ = ch;
  80026d:	8d 4a 01             	lea    0x1(%edx),%ecx
  800270:	89 08                	mov    %ecx,(%eax)
  800272:	8b 45 08             	mov    0x8(%ebp),%eax
  800275:	88 02                	mov    %al,(%edx)
}
  800277:	5d                   	pop    %ebp
  800278:	c3                   	ret    

00800279 <printfmt>:
{
  800279:	f3 0f 1e fb          	endbr32 
  80027d:	55                   	push   %ebp
  80027e:	89 e5                	mov    %esp,%ebp
  800280:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800283:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800286:	50                   	push   %eax
  800287:	ff 75 10             	pushl  0x10(%ebp)
  80028a:	ff 75 0c             	pushl  0xc(%ebp)
  80028d:	ff 75 08             	pushl  0x8(%ebp)
  800290:	e8 05 00 00 00       	call   80029a <vprintfmt>
}
  800295:	83 c4 10             	add    $0x10,%esp
  800298:	c9                   	leave  
  800299:	c3                   	ret    

0080029a <vprintfmt>:
{
  80029a:	f3 0f 1e fb          	endbr32 
  80029e:	55                   	push   %ebp
  80029f:	89 e5                	mov    %esp,%ebp
  8002a1:	57                   	push   %edi
  8002a2:	56                   	push   %esi
  8002a3:	53                   	push   %ebx
  8002a4:	83 ec 3c             	sub    $0x3c,%esp
  8002a7:	8b 75 08             	mov    0x8(%ebp),%esi
  8002aa:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8002ad:	8b 7d 10             	mov    0x10(%ebp),%edi
  8002b0:	e9 5d 03 00 00       	jmp    800612 <vprintfmt+0x378>
		padc = ' ';
  8002b5:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8002b9:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  8002c0:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  8002c7:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  8002ce:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8002d3:	8d 47 01             	lea    0x1(%edi),%eax
  8002d6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8002d9:	0f b6 17             	movzbl (%edi),%edx
  8002dc:	8d 42 dd             	lea    -0x23(%edx),%eax
  8002df:	3c 55                	cmp    $0x55,%al
  8002e1:	0f 87 ae 03 00 00    	ja     800695 <vprintfmt+0x3fb>
  8002e7:	0f b6 c0             	movzbl %al,%eax
  8002ea:	3e ff 24 85 20 21 80 	notrack jmp *0x802120(,%eax,4)
  8002f1:	00 
  8002f2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  8002f5:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  8002f9:	eb d8                	jmp    8002d3 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8002fb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  8002fe:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800302:	eb cf                	jmp    8002d3 <vprintfmt+0x39>
  800304:	0f b6 d2             	movzbl %dl,%edx
  800307:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80030a:	b8 00 00 00 00       	mov    $0x0,%eax
  80030f:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800312:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800315:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800319:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80031c:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80031f:	83 f9 09             	cmp    $0x9,%ecx
  800322:	77 55                	ja     800379 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800324:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800327:	eb e9                	jmp    800312 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800329:	8b 45 14             	mov    0x14(%ebp),%eax
  80032c:	8b 00                	mov    (%eax),%eax
  80032e:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800331:	8b 45 14             	mov    0x14(%ebp),%eax
  800334:	8d 40 04             	lea    0x4(%eax),%eax
  800337:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80033a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  80033d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800341:	79 90                	jns    8002d3 <vprintfmt+0x39>
				width = precision, precision = -1;
  800343:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800346:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800349:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800350:	eb 81                	jmp    8002d3 <vprintfmt+0x39>
  800352:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800355:	85 c0                	test   %eax,%eax
  800357:	ba 00 00 00 00       	mov    $0x0,%edx
  80035c:	0f 49 d0             	cmovns %eax,%edx
  80035f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800362:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800365:	e9 69 ff ff ff       	jmp    8002d3 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80036a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  80036d:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800374:	e9 5a ff ff ff       	jmp    8002d3 <vprintfmt+0x39>
  800379:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80037c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80037f:	eb bc                	jmp    80033d <vprintfmt+0xa3>
			lflag++;
  800381:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800384:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800387:	e9 47 ff ff ff       	jmp    8002d3 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80038c:	8b 45 14             	mov    0x14(%ebp),%eax
  80038f:	8d 78 04             	lea    0x4(%eax),%edi
  800392:	83 ec 08             	sub    $0x8,%esp
  800395:	53                   	push   %ebx
  800396:	ff 30                	pushl  (%eax)
  800398:	ff d6                	call   *%esi
			break;
  80039a:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80039d:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8003a0:	e9 6a 02 00 00       	jmp    80060f <vprintfmt+0x375>
			err = va_arg(ap, int);
  8003a5:	8b 45 14             	mov    0x14(%ebp),%eax
  8003a8:	8d 78 04             	lea    0x4(%eax),%edi
  8003ab:	8b 00                	mov    (%eax),%eax
  8003ad:	99                   	cltd   
  8003ae:	31 d0                	xor    %edx,%eax
  8003b0:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8003b2:	83 f8 0f             	cmp    $0xf,%eax
  8003b5:	7f 23                	jg     8003da <vprintfmt+0x140>
  8003b7:	8b 14 85 80 22 80 00 	mov    0x802280(,%eax,4),%edx
  8003be:	85 d2                	test   %edx,%edx
  8003c0:	74 18                	je     8003da <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  8003c2:	52                   	push   %edx
  8003c3:	68 21 24 80 00       	push   $0x802421
  8003c8:	53                   	push   %ebx
  8003c9:	56                   	push   %esi
  8003ca:	e8 aa fe ff ff       	call   800279 <printfmt>
  8003cf:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  8003d2:	89 7d 14             	mov    %edi,0x14(%ebp)
  8003d5:	e9 35 02 00 00       	jmp    80060f <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  8003da:	50                   	push   %eax
  8003db:	68 fe 1f 80 00       	push   $0x801ffe
  8003e0:	53                   	push   %ebx
  8003e1:	56                   	push   %esi
  8003e2:	e8 92 fe ff ff       	call   800279 <printfmt>
  8003e7:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  8003ea:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  8003ed:	e9 1d 02 00 00       	jmp    80060f <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  8003f2:	8b 45 14             	mov    0x14(%ebp),%eax
  8003f5:	83 c0 04             	add    $0x4,%eax
  8003f8:	89 45 c8             	mov    %eax,-0x38(%ebp)
  8003fb:	8b 45 14             	mov    0x14(%ebp),%eax
  8003fe:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800400:	85 d2                	test   %edx,%edx
  800402:	b8 f7 1f 80 00       	mov    $0x801ff7,%eax
  800407:	0f 45 c2             	cmovne %edx,%eax
  80040a:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80040d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800411:	7e 06                	jle    800419 <vprintfmt+0x17f>
  800413:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800417:	75 0d                	jne    800426 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800419:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80041c:	89 c7                	mov    %eax,%edi
  80041e:	03 45 d4             	add    -0x2c(%ebp),%eax
  800421:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800424:	eb 55                	jmp    80047b <vprintfmt+0x1e1>
  800426:	83 ec 08             	sub    $0x8,%esp
  800429:	ff 75 d8             	pushl  -0x28(%ebp)
  80042c:	ff 75 cc             	pushl  -0x34(%ebp)
  80042f:	e8 15 03 00 00       	call   800749 <strnlen>
  800434:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800437:	29 c2                	sub    %eax,%edx
  800439:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  80043c:	83 c4 10             	add    $0x10,%esp
  80043f:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800441:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800445:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800448:	85 ff                	test   %edi,%edi
  80044a:	7e 11                	jle    80045d <vprintfmt+0x1c3>
					putch(padc, putdat);
  80044c:	83 ec 08             	sub    $0x8,%esp
  80044f:	53                   	push   %ebx
  800450:	ff 75 d4             	pushl  -0x2c(%ebp)
  800453:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800455:	83 ef 01             	sub    $0x1,%edi
  800458:	83 c4 10             	add    $0x10,%esp
  80045b:	eb eb                	jmp    800448 <vprintfmt+0x1ae>
  80045d:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800460:	85 d2                	test   %edx,%edx
  800462:	b8 00 00 00 00       	mov    $0x0,%eax
  800467:	0f 49 c2             	cmovns %edx,%eax
  80046a:	29 c2                	sub    %eax,%edx
  80046c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  80046f:	eb a8                	jmp    800419 <vprintfmt+0x17f>
					putch(ch, putdat);
  800471:	83 ec 08             	sub    $0x8,%esp
  800474:	53                   	push   %ebx
  800475:	52                   	push   %edx
  800476:	ff d6                	call   *%esi
  800478:	83 c4 10             	add    $0x10,%esp
  80047b:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80047e:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800480:	83 c7 01             	add    $0x1,%edi
  800483:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800487:	0f be d0             	movsbl %al,%edx
  80048a:	85 d2                	test   %edx,%edx
  80048c:	74 4b                	je     8004d9 <vprintfmt+0x23f>
  80048e:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800492:	78 06                	js     80049a <vprintfmt+0x200>
  800494:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800498:	78 1e                	js     8004b8 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80049a:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80049e:	74 d1                	je     800471 <vprintfmt+0x1d7>
  8004a0:	0f be c0             	movsbl %al,%eax
  8004a3:	83 e8 20             	sub    $0x20,%eax
  8004a6:	83 f8 5e             	cmp    $0x5e,%eax
  8004a9:	76 c6                	jbe    800471 <vprintfmt+0x1d7>
					putch('?', putdat);
  8004ab:	83 ec 08             	sub    $0x8,%esp
  8004ae:	53                   	push   %ebx
  8004af:	6a 3f                	push   $0x3f
  8004b1:	ff d6                	call   *%esi
  8004b3:	83 c4 10             	add    $0x10,%esp
  8004b6:	eb c3                	jmp    80047b <vprintfmt+0x1e1>
  8004b8:	89 cf                	mov    %ecx,%edi
  8004ba:	eb 0e                	jmp    8004ca <vprintfmt+0x230>
				putch(' ', putdat);
  8004bc:	83 ec 08             	sub    $0x8,%esp
  8004bf:	53                   	push   %ebx
  8004c0:	6a 20                	push   $0x20
  8004c2:	ff d6                	call   *%esi
			for (; width > 0; width--)
  8004c4:	83 ef 01             	sub    $0x1,%edi
  8004c7:	83 c4 10             	add    $0x10,%esp
  8004ca:	85 ff                	test   %edi,%edi
  8004cc:	7f ee                	jg     8004bc <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  8004ce:	8b 45 c8             	mov    -0x38(%ebp),%eax
  8004d1:	89 45 14             	mov    %eax,0x14(%ebp)
  8004d4:	e9 36 01 00 00       	jmp    80060f <vprintfmt+0x375>
  8004d9:	89 cf                	mov    %ecx,%edi
  8004db:	eb ed                	jmp    8004ca <vprintfmt+0x230>
	if (lflag >= 2)
  8004dd:	83 f9 01             	cmp    $0x1,%ecx
  8004e0:	7f 1f                	jg     800501 <vprintfmt+0x267>
	else if (lflag)
  8004e2:	85 c9                	test   %ecx,%ecx
  8004e4:	74 67                	je     80054d <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  8004e6:	8b 45 14             	mov    0x14(%ebp),%eax
  8004e9:	8b 00                	mov    (%eax),%eax
  8004eb:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004ee:	89 c1                	mov    %eax,%ecx
  8004f0:	c1 f9 1f             	sar    $0x1f,%ecx
  8004f3:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8004f6:	8b 45 14             	mov    0x14(%ebp),%eax
  8004f9:	8d 40 04             	lea    0x4(%eax),%eax
  8004fc:	89 45 14             	mov    %eax,0x14(%ebp)
  8004ff:	eb 17                	jmp    800518 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800501:	8b 45 14             	mov    0x14(%ebp),%eax
  800504:	8b 50 04             	mov    0x4(%eax),%edx
  800507:	8b 00                	mov    (%eax),%eax
  800509:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80050c:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80050f:	8b 45 14             	mov    0x14(%ebp),%eax
  800512:	8d 40 08             	lea    0x8(%eax),%eax
  800515:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800518:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80051b:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80051e:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800523:	85 c9                	test   %ecx,%ecx
  800525:	0f 89 ca 00 00 00    	jns    8005f5 <vprintfmt+0x35b>
				putch('-', putdat);
  80052b:	83 ec 08             	sub    $0x8,%esp
  80052e:	53                   	push   %ebx
  80052f:	6a 2d                	push   $0x2d
  800531:	ff d6                	call   *%esi
				num = -(long long) num;
  800533:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800536:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800539:	f7 da                	neg    %edx
  80053b:	83 d1 00             	adc    $0x0,%ecx
  80053e:	f7 d9                	neg    %ecx
  800540:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800543:	b8 0a 00 00 00       	mov    $0xa,%eax
  800548:	e9 a8 00 00 00       	jmp    8005f5 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80054d:	8b 45 14             	mov    0x14(%ebp),%eax
  800550:	8b 00                	mov    (%eax),%eax
  800552:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800555:	99                   	cltd   
  800556:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800559:	8b 45 14             	mov    0x14(%ebp),%eax
  80055c:	8d 40 04             	lea    0x4(%eax),%eax
  80055f:	89 45 14             	mov    %eax,0x14(%ebp)
  800562:	eb b4                	jmp    800518 <vprintfmt+0x27e>
	if (lflag >= 2)
  800564:	83 f9 01             	cmp    $0x1,%ecx
  800567:	7f 1b                	jg     800584 <vprintfmt+0x2ea>
	else if (lflag)
  800569:	85 c9                	test   %ecx,%ecx
  80056b:	74 2c                	je     800599 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80056d:	8b 45 14             	mov    0x14(%ebp),%eax
  800570:	8b 10                	mov    (%eax),%edx
  800572:	b9 00 00 00 00       	mov    $0x0,%ecx
  800577:	8d 40 04             	lea    0x4(%eax),%eax
  80057a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80057d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800582:	eb 71                	jmp    8005f5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800584:	8b 45 14             	mov    0x14(%ebp),%eax
  800587:	8b 10                	mov    (%eax),%edx
  800589:	8b 48 04             	mov    0x4(%eax),%ecx
  80058c:	8d 40 08             	lea    0x8(%eax),%eax
  80058f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800592:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800597:	eb 5c                	jmp    8005f5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800599:	8b 45 14             	mov    0x14(%ebp),%eax
  80059c:	8b 10                	mov    (%eax),%edx
  80059e:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005a3:	8d 40 04             	lea    0x4(%eax),%eax
  8005a6:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005a9:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8005ae:	eb 45                	jmp    8005f5 <vprintfmt+0x35b>
			putch('X', putdat);
  8005b0:	83 ec 08             	sub    $0x8,%esp
  8005b3:	53                   	push   %ebx
  8005b4:	6a 58                	push   $0x58
  8005b6:	ff d6                	call   *%esi
			putch('X', putdat);
  8005b8:	83 c4 08             	add    $0x8,%esp
  8005bb:	53                   	push   %ebx
  8005bc:	6a 58                	push   $0x58
  8005be:	ff d6                	call   *%esi
			putch('X', putdat);
  8005c0:	83 c4 08             	add    $0x8,%esp
  8005c3:	53                   	push   %ebx
  8005c4:	6a 58                	push   $0x58
  8005c6:	ff d6                	call   *%esi
			break;
  8005c8:	83 c4 10             	add    $0x10,%esp
  8005cb:	eb 42                	jmp    80060f <vprintfmt+0x375>
			putch('0', putdat);
  8005cd:	83 ec 08             	sub    $0x8,%esp
  8005d0:	53                   	push   %ebx
  8005d1:	6a 30                	push   $0x30
  8005d3:	ff d6                	call   *%esi
			putch('x', putdat);
  8005d5:	83 c4 08             	add    $0x8,%esp
  8005d8:	53                   	push   %ebx
  8005d9:	6a 78                	push   $0x78
  8005db:	ff d6                	call   *%esi
			num = (unsigned long long)
  8005dd:	8b 45 14             	mov    0x14(%ebp),%eax
  8005e0:	8b 10                	mov    (%eax),%edx
  8005e2:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  8005e7:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  8005ea:	8d 40 04             	lea    0x4(%eax),%eax
  8005ed:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8005f0:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  8005f5:	83 ec 0c             	sub    $0xc,%esp
  8005f8:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  8005fc:	57                   	push   %edi
  8005fd:	ff 75 d4             	pushl  -0x2c(%ebp)
  800600:	50                   	push   %eax
  800601:	51                   	push   %ecx
  800602:	52                   	push   %edx
  800603:	89 da                	mov    %ebx,%edx
  800605:	89 f0                	mov    %esi,%eax
  800607:	e8 a3 fb ff ff       	call   8001af <printnum>
			break;
  80060c:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80060f:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800612:	83 c7 01             	add    $0x1,%edi
  800615:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800619:	83 f8 25             	cmp    $0x25,%eax
  80061c:	0f 84 93 fc ff ff    	je     8002b5 <vprintfmt+0x1b>
			if (ch == '\0')
  800622:	85 c0                	test   %eax,%eax
  800624:	0f 84 8b 00 00 00    	je     8006b5 <vprintfmt+0x41b>
			putch(ch, putdat);
  80062a:	83 ec 08             	sub    $0x8,%esp
  80062d:	53                   	push   %ebx
  80062e:	50                   	push   %eax
  80062f:	ff d6                	call   *%esi
  800631:	83 c4 10             	add    $0x10,%esp
  800634:	eb dc                	jmp    800612 <vprintfmt+0x378>
	if (lflag >= 2)
  800636:	83 f9 01             	cmp    $0x1,%ecx
  800639:	7f 1b                	jg     800656 <vprintfmt+0x3bc>
	else if (lflag)
  80063b:	85 c9                	test   %ecx,%ecx
  80063d:	74 2c                	je     80066b <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  80063f:	8b 45 14             	mov    0x14(%ebp),%eax
  800642:	8b 10                	mov    (%eax),%edx
  800644:	b9 00 00 00 00       	mov    $0x0,%ecx
  800649:	8d 40 04             	lea    0x4(%eax),%eax
  80064c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80064f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800654:	eb 9f                	jmp    8005f5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800656:	8b 45 14             	mov    0x14(%ebp),%eax
  800659:	8b 10                	mov    (%eax),%edx
  80065b:	8b 48 04             	mov    0x4(%eax),%ecx
  80065e:	8d 40 08             	lea    0x8(%eax),%eax
  800661:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800664:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800669:	eb 8a                	jmp    8005f5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80066b:	8b 45 14             	mov    0x14(%ebp),%eax
  80066e:	8b 10                	mov    (%eax),%edx
  800670:	b9 00 00 00 00       	mov    $0x0,%ecx
  800675:	8d 40 04             	lea    0x4(%eax),%eax
  800678:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80067b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800680:	e9 70 ff ff ff       	jmp    8005f5 <vprintfmt+0x35b>
			putch(ch, putdat);
  800685:	83 ec 08             	sub    $0x8,%esp
  800688:	53                   	push   %ebx
  800689:	6a 25                	push   $0x25
  80068b:	ff d6                	call   *%esi
			break;
  80068d:	83 c4 10             	add    $0x10,%esp
  800690:	e9 7a ff ff ff       	jmp    80060f <vprintfmt+0x375>
			putch('%', putdat);
  800695:	83 ec 08             	sub    $0x8,%esp
  800698:	53                   	push   %ebx
  800699:	6a 25                	push   $0x25
  80069b:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80069d:	83 c4 10             	add    $0x10,%esp
  8006a0:	89 f8                	mov    %edi,%eax
  8006a2:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8006a6:	74 05                	je     8006ad <vprintfmt+0x413>
  8006a8:	83 e8 01             	sub    $0x1,%eax
  8006ab:	eb f5                	jmp    8006a2 <vprintfmt+0x408>
  8006ad:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8006b0:	e9 5a ff ff ff       	jmp    80060f <vprintfmt+0x375>
}
  8006b5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8006b8:	5b                   	pop    %ebx
  8006b9:	5e                   	pop    %esi
  8006ba:	5f                   	pop    %edi
  8006bb:	5d                   	pop    %ebp
  8006bc:	c3                   	ret    

008006bd <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8006bd:	f3 0f 1e fb          	endbr32 
  8006c1:	55                   	push   %ebp
  8006c2:	89 e5                	mov    %esp,%ebp
  8006c4:	83 ec 18             	sub    $0x18,%esp
  8006c7:	8b 45 08             	mov    0x8(%ebp),%eax
  8006ca:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  8006cd:	89 45 ec             	mov    %eax,-0x14(%ebp)
  8006d0:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  8006d4:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  8006d7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  8006de:	85 c0                	test   %eax,%eax
  8006e0:	74 26                	je     800708 <vsnprintf+0x4b>
  8006e2:	85 d2                	test   %edx,%edx
  8006e4:	7e 22                	jle    800708 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  8006e6:	ff 75 14             	pushl  0x14(%ebp)
  8006e9:	ff 75 10             	pushl  0x10(%ebp)
  8006ec:	8d 45 ec             	lea    -0x14(%ebp),%eax
  8006ef:	50                   	push   %eax
  8006f0:	68 58 02 80 00       	push   $0x800258
  8006f5:	e8 a0 fb ff ff       	call   80029a <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  8006fa:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8006fd:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800700:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800703:	83 c4 10             	add    $0x10,%esp
}
  800706:	c9                   	leave  
  800707:	c3                   	ret    
		return -E_INVAL;
  800708:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80070d:	eb f7                	jmp    800706 <vsnprintf+0x49>

0080070f <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80070f:	f3 0f 1e fb          	endbr32 
  800713:	55                   	push   %ebp
  800714:	89 e5                	mov    %esp,%ebp
  800716:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800719:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80071c:	50                   	push   %eax
  80071d:	ff 75 10             	pushl  0x10(%ebp)
  800720:	ff 75 0c             	pushl  0xc(%ebp)
  800723:	ff 75 08             	pushl  0x8(%ebp)
  800726:	e8 92 ff ff ff       	call   8006bd <vsnprintf>
	va_end(ap);

	return rc;
}
  80072b:	c9                   	leave  
  80072c:	c3                   	ret    

0080072d <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  80072d:	f3 0f 1e fb          	endbr32 
  800731:	55                   	push   %ebp
  800732:	89 e5                	mov    %esp,%ebp
  800734:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800737:	b8 00 00 00 00       	mov    $0x0,%eax
  80073c:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800740:	74 05                	je     800747 <strlen+0x1a>
		n++;
  800742:	83 c0 01             	add    $0x1,%eax
  800745:	eb f5                	jmp    80073c <strlen+0xf>
	return n;
}
  800747:	5d                   	pop    %ebp
  800748:	c3                   	ret    

00800749 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800749:	f3 0f 1e fb          	endbr32 
  80074d:	55                   	push   %ebp
  80074e:	89 e5                	mov    %esp,%ebp
  800750:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800753:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800756:	b8 00 00 00 00       	mov    $0x0,%eax
  80075b:	39 d0                	cmp    %edx,%eax
  80075d:	74 0d                	je     80076c <strnlen+0x23>
  80075f:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800763:	74 05                	je     80076a <strnlen+0x21>
		n++;
  800765:	83 c0 01             	add    $0x1,%eax
  800768:	eb f1                	jmp    80075b <strnlen+0x12>
  80076a:	89 c2                	mov    %eax,%edx
	return n;
}
  80076c:	89 d0                	mov    %edx,%eax
  80076e:	5d                   	pop    %ebp
  80076f:	c3                   	ret    

00800770 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800770:	f3 0f 1e fb          	endbr32 
  800774:	55                   	push   %ebp
  800775:	89 e5                	mov    %esp,%ebp
  800777:	53                   	push   %ebx
  800778:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80077b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80077e:	b8 00 00 00 00       	mov    $0x0,%eax
  800783:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800787:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80078a:	83 c0 01             	add    $0x1,%eax
  80078d:	84 d2                	test   %dl,%dl
  80078f:	75 f2                	jne    800783 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800791:	89 c8                	mov    %ecx,%eax
  800793:	5b                   	pop    %ebx
  800794:	5d                   	pop    %ebp
  800795:	c3                   	ret    

00800796 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800796:	f3 0f 1e fb          	endbr32 
  80079a:	55                   	push   %ebp
  80079b:	89 e5                	mov    %esp,%ebp
  80079d:	53                   	push   %ebx
  80079e:	83 ec 10             	sub    $0x10,%esp
  8007a1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8007a4:	53                   	push   %ebx
  8007a5:	e8 83 ff ff ff       	call   80072d <strlen>
  8007aa:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8007ad:	ff 75 0c             	pushl  0xc(%ebp)
  8007b0:	01 d8                	add    %ebx,%eax
  8007b2:	50                   	push   %eax
  8007b3:	e8 b8 ff ff ff       	call   800770 <strcpy>
	return dst;
}
  8007b8:	89 d8                	mov    %ebx,%eax
  8007ba:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8007bd:	c9                   	leave  
  8007be:	c3                   	ret    

008007bf <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  8007bf:	f3 0f 1e fb          	endbr32 
  8007c3:	55                   	push   %ebp
  8007c4:	89 e5                	mov    %esp,%ebp
  8007c6:	56                   	push   %esi
  8007c7:	53                   	push   %ebx
  8007c8:	8b 75 08             	mov    0x8(%ebp),%esi
  8007cb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8007ce:	89 f3                	mov    %esi,%ebx
  8007d0:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  8007d3:	89 f0                	mov    %esi,%eax
  8007d5:	39 d8                	cmp    %ebx,%eax
  8007d7:	74 11                	je     8007ea <strncpy+0x2b>
		*dst++ = *src;
  8007d9:	83 c0 01             	add    $0x1,%eax
  8007dc:	0f b6 0a             	movzbl (%edx),%ecx
  8007df:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  8007e2:	80 f9 01             	cmp    $0x1,%cl
  8007e5:	83 da ff             	sbb    $0xffffffff,%edx
  8007e8:	eb eb                	jmp    8007d5 <strncpy+0x16>
	}
	return ret;
}
  8007ea:	89 f0                	mov    %esi,%eax
  8007ec:	5b                   	pop    %ebx
  8007ed:	5e                   	pop    %esi
  8007ee:	5d                   	pop    %ebp
  8007ef:	c3                   	ret    

008007f0 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  8007f0:	f3 0f 1e fb          	endbr32 
  8007f4:	55                   	push   %ebp
  8007f5:	89 e5                	mov    %esp,%ebp
  8007f7:	56                   	push   %esi
  8007f8:	53                   	push   %ebx
  8007f9:	8b 75 08             	mov    0x8(%ebp),%esi
  8007fc:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8007ff:	8b 55 10             	mov    0x10(%ebp),%edx
  800802:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800804:	85 d2                	test   %edx,%edx
  800806:	74 21                	je     800829 <strlcpy+0x39>
  800808:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80080c:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80080e:	39 c2                	cmp    %eax,%edx
  800810:	74 14                	je     800826 <strlcpy+0x36>
  800812:	0f b6 19             	movzbl (%ecx),%ebx
  800815:	84 db                	test   %bl,%bl
  800817:	74 0b                	je     800824 <strlcpy+0x34>
			*dst++ = *src++;
  800819:	83 c1 01             	add    $0x1,%ecx
  80081c:	83 c2 01             	add    $0x1,%edx
  80081f:	88 5a ff             	mov    %bl,-0x1(%edx)
  800822:	eb ea                	jmp    80080e <strlcpy+0x1e>
  800824:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800826:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800829:	29 f0                	sub    %esi,%eax
}
  80082b:	5b                   	pop    %ebx
  80082c:	5e                   	pop    %esi
  80082d:	5d                   	pop    %ebp
  80082e:	c3                   	ret    

0080082f <strcmp>:

int
strcmp(const char *p, const char *q)
{
  80082f:	f3 0f 1e fb          	endbr32 
  800833:	55                   	push   %ebp
  800834:	89 e5                	mov    %esp,%ebp
  800836:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800839:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  80083c:	0f b6 01             	movzbl (%ecx),%eax
  80083f:	84 c0                	test   %al,%al
  800841:	74 0c                	je     80084f <strcmp+0x20>
  800843:	3a 02                	cmp    (%edx),%al
  800845:	75 08                	jne    80084f <strcmp+0x20>
		p++, q++;
  800847:	83 c1 01             	add    $0x1,%ecx
  80084a:	83 c2 01             	add    $0x1,%edx
  80084d:	eb ed                	jmp    80083c <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  80084f:	0f b6 c0             	movzbl %al,%eax
  800852:	0f b6 12             	movzbl (%edx),%edx
  800855:	29 d0                	sub    %edx,%eax
}
  800857:	5d                   	pop    %ebp
  800858:	c3                   	ret    

00800859 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800859:	f3 0f 1e fb          	endbr32 
  80085d:	55                   	push   %ebp
  80085e:	89 e5                	mov    %esp,%ebp
  800860:	53                   	push   %ebx
  800861:	8b 45 08             	mov    0x8(%ebp),%eax
  800864:	8b 55 0c             	mov    0xc(%ebp),%edx
  800867:	89 c3                	mov    %eax,%ebx
  800869:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  80086c:	eb 06                	jmp    800874 <strncmp+0x1b>
		n--, p++, q++;
  80086e:	83 c0 01             	add    $0x1,%eax
  800871:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800874:	39 d8                	cmp    %ebx,%eax
  800876:	74 16                	je     80088e <strncmp+0x35>
  800878:	0f b6 08             	movzbl (%eax),%ecx
  80087b:	84 c9                	test   %cl,%cl
  80087d:	74 04                	je     800883 <strncmp+0x2a>
  80087f:	3a 0a                	cmp    (%edx),%cl
  800881:	74 eb                	je     80086e <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800883:	0f b6 00             	movzbl (%eax),%eax
  800886:	0f b6 12             	movzbl (%edx),%edx
  800889:	29 d0                	sub    %edx,%eax
}
  80088b:	5b                   	pop    %ebx
  80088c:	5d                   	pop    %ebp
  80088d:	c3                   	ret    
		return 0;
  80088e:	b8 00 00 00 00       	mov    $0x0,%eax
  800893:	eb f6                	jmp    80088b <strncmp+0x32>

00800895 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800895:	f3 0f 1e fb          	endbr32 
  800899:	55                   	push   %ebp
  80089a:	89 e5                	mov    %esp,%ebp
  80089c:	8b 45 08             	mov    0x8(%ebp),%eax
  80089f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008a3:	0f b6 10             	movzbl (%eax),%edx
  8008a6:	84 d2                	test   %dl,%dl
  8008a8:	74 09                	je     8008b3 <strchr+0x1e>
		if (*s == c)
  8008aa:	38 ca                	cmp    %cl,%dl
  8008ac:	74 0a                	je     8008b8 <strchr+0x23>
	for (; *s; s++)
  8008ae:	83 c0 01             	add    $0x1,%eax
  8008b1:	eb f0                	jmp    8008a3 <strchr+0xe>
			return (char *) s;
	return 0;
  8008b3:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8008b8:	5d                   	pop    %ebp
  8008b9:	c3                   	ret    

008008ba <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8008ba:	f3 0f 1e fb          	endbr32 
  8008be:	55                   	push   %ebp
  8008bf:	89 e5                	mov    %esp,%ebp
  8008c1:	8b 45 08             	mov    0x8(%ebp),%eax
  8008c4:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008c8:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  8008cb:	38 ca                	cmp    %cl,%dl
  8008cd:	74 09                	je     8008d8 <strfind+0x1e>
  8008cf:	84 d2                	test   %dl,%dl
  8008d1:	74 05                	je     8008d8 <strfind+0x1e>
	for (; *s; s++)
  8008d3:	83 c0 01             	add    $0x1,%eax
  8008d6:	eb f0                	jmp    8008c8 <strfind+0xe>
			break;
	return (char *) s;
}
  8008d8:	5d                   	pop    %ebp
  8008d9:	c3                   	ret    

008008da <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  8008da:	f3 0f 1e fb          	endbr32 
  8008de:	55                   	push   %ebp
  8008df:	89 e5                	mov    %esp,%ebp
  8008e1:	57                   	push   %edi
  8008e2:	56                   	push   %esi
  8008e3:	53                   	push   %ebx
  8008e4:	8b 7d 08             	mov    0x8(%ebp),%edi
  8008e7:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  8008ea:	85 c9                	test   %ecx,%ecx
  8008ec:	74 31                	je     80091f <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  8008ee:	89 f8                	mov    %edi,%eax
  8008f0:	09 c8                	or     %ecx,%eax
  8008f2:	a8 03                	test   $0x3,%al
  8008f4:	75 23                	jne    800919 <memset+0x3f>
		c &= 0xFF;
  8008f6:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  8008fa:	89 d3                	mov    %edx,%ebx
  8008fc:	c1 e3 08             	shl    $0x8,%ebx
  8008ff:	89 d0                	mov    %edx,%eax
  800901:	c1 e0 18             	shl    $0x18,%eax
  800904:	89 d6                	mov    %edx,%esi
  800906:	c1 e6 10             	shl    $0x10,%esi
  800909:	09 f0                	or     %esi,%eax
  80090b:	09 c2                	or     %eax,%edx
  80090d:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  80090f:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800912:	89 d0                	mov    %edx,%eax
  800914:	fc                   	cld    
  800915:	f3 ab                	rep stos %eax,%es:(%edi)
  800917:	eb 06                	jmp    80091f <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800919:	8b 45 0c             	mov    0xc(%ebp),%eax
  80091c:	fc                   	cld    
  80091d:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  80091f:	89 f8                	mov    %edi,%eax
  800921:	5b                   	pop    %ebx
  800922:	5e                   	pop    %esi
  800923:	5f                   	pop    %edi
  800924:	5d                   	pop    %ebp
  800925:	c3                   	ret    

00800926 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800926:	f3 0f 1e fb          	endbr32 
  80092a:	55                   	push   %ebp
  80092b:	89 e5                	mov    %esp,%ebp
  80092d:	57                   	push   %edi
  80092e:	56                   	push   %esi
  80092f:	8b 45 08             	mov    0x8(%ebp),%eax
  800932:	8b 75 0c             	mov    0xc(%ebp),%esi
  800935:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800938:	39 c6                	cmp    %eax,%esi
  80093a:	73 32                	jae    80096e <memmove+0x48>
  80093c:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  80093f:	39 c2                	cmp    %eax,%edx
  800941:	76 2b                	jbe    80096e <memmove+0x48>
		s += n;
		d += n;
  800943:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800946:	89 fe                	mov    %edi,%esi
  800948:	09 ce                	or     %ecx,%esi
  80094a:	09 d6                	or     %edx,%esi
  80094c:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800952:	75 0e                	jne    800962 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800954:	83 ef 04             	sub    $0x4,%edi
  800957:	8d 72 fc             	lea    -0x4(%edx),%esi
  80095a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  80095d:	fd                   	std    
  80095e:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800960:	eb 09                	jmp    80096b <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800962:	83 ef 01             	sub    $0x1,%edi
  800965:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800968:	fd                   	std    
  800969:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  80096b:	fc                   	cld    
  80096c:	eb 1a                	jmp    800988 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  80096e:	89 c2                	mov    %eax,%edx
  800970:	09 ca                	or     %ecx,%edx
  800972:	09 f2                	or     %esi,%edx
  800974:	f6 c2 03             	test   $0x3,%dl
  800977:	75 0a                	jne    800983 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800979:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  80097c:	89 c7                	mov    %eax,%edi
  80097e:	fc                   	cld    
  80097f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800981:	eb 05                	jmp    800988 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800983:	89 c7                	mov    %eax,%edi
  800985:	fc                   	cld    
  800986:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800988:	5e                   	pop    %esi
  800989:	5f                   	pop    %edi
  80098a:	5d                   	pop    %ebp
  80098b:	c3                   	ret    

0080098c <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  80098c:	f3 0f 1e fb          	endbr32 
  800990:	55                   	push   %ebp
  800991:	89 e5                	mov    %esp,%ebp
  800993:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800996:	ff 75 10             	pushl  0x10(%ebp)
  800999:	ff 75 0c             	pushl  0xc(%ebp)
  80099c:	ff 75 08             	pushl  0x8(%ebp)
  80099f:	e8 82 ff ff ff       	call   800926 <memmove>
}
  8009a4:	c9                   	leave  
  8009a5:	c3                   	ret    

008009a6 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  8009a6:	f3 0f 1e fb          	endbr32 
  8009aa:	55                   	push   %ebp
  8009ab:	89 e5                	mov    %esp,%ebp
  8009ad:	56                   	push   %esi
  8009ae:	53                   	push   %ebx
  8009af:	8b 45 08             	mov    0x8(%ebp),%eax
  8009b2:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009b5:	89 c6                	mov    %eax,%esi
  8009b7:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  8009ba:	39 f0                	cmp    %esi,%eax
  8009bc:	74 1c                	je     8009da <memcmp+0x34>
		if (*s1 != *s2)
  8009be:	0f b6 08             	movzbl (%eax),%ecx
  8009c1:	0f b6 1a             	movzbl (%edx),%ebx
  8009c4:	38 d9                	cmp    %bl,%cl
  8009c6:	75 08                	jne    8009d0 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  8009c8:	83 c0 01             	add    $0x1,%eax
  8009cb:	83 c2 01             	add    $0x1,%edx
  8009ce:	eb ea                	jmp    8009ba <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  8009d0:	0f b6 c1             	movzbl %cl,%eax
  8009d3:	0f b6 db             	movzbl %bl,%ebx
  8009d6:	29 d8                	sub    %ebx,%eax
  8009d8:	eb 05                	jmp    8009df <memcmp+0x39>
	}

	return 0;
  8009da:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8009df:	5b                   	pop    %ebx
  8009e0:	5e                   	pop    %esi
  8009e1:	5d                   	pop    %ebp
  8009e2:	c3                   	ret    

008009e3 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  8009e3:	f3 0f 1e fb          	endbr32 
  8009e7:	55                   	push   %ebp
  8009e8:	89 e5                	mov    %esp,%ebp
  8009ea:	8b 45 08             	mov    0x8(%ebp),%eax
  8009ed:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  8009f0:	89 c2                	mov    %eax,%edx
  8009f2:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  8009f5:	39 d0                	cmp    %edx,%eax
  8009f7:	73 09                	jae    800a02 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  8009f9:	38 08                	cmp    %cl,(%eax)
  8009fb:	74 05                	je     800a02 <memfind+0x1f>
	for (; s < ends; s++)
  8009fd:	83 c0 01             	add    $0x1,%eax
  800a00:	eb f3                	jmp    8009f5 <memfind+0x12>
			break;
	return (void *) s;
}
  800a02:	5d                   	pop    %ebp
  800a03:	c3                   	ret    

00800a04 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a04:	f3 0f 1e fb          	endbr32 
  800a08:	55                   	push   %ebp
  800a09:	89 e5                	mov    %esp,%ebp
  800a0b:	57                   	push   %edi
  800a0c:	56                   	push   %esi
  800a0d:	53                   	push   %ebx
  800a0e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a11:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a14:	eb 03                	jmp    800a19 <strtol+0x15>
		s++;
  800a16:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a19:	0f b6 01             	movzbl (%ecx),%eax
  800a1c:	3c 20                	cmp    $0x20,%al
  800a1e:	74 f6                	je     800a16 <strtol+0x12>
  800a20:	3c 09                	cmp    $0x9,%al
  800a22:	74 f2                	je     800a16 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800a24:	3c 2b                	cmp    $0x2b,%al
  800a26:	74 2a                	je     800a52 <strtol+0x4e>
	int neg = 0;
  800a28:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800a2d:	3c 2d                	cmp    $0x2d,%al
  800a2f:	74 2b                	je     800a5c <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a31:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800a37:	75 0f                	jne    800a48 <strtol+0x44>
  800a39:	80 39 30             	cmpb   $0x30,(%ecx)
  800a3c:	74 28                	je     800a66 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800a3e:	85 db                	test   %ebx,%ebx
  800a40:	b8 0a 00 00 00       	mov    $0xa,%eax
  800a45:	0f 44 d8             	cmove  %eax,%ebx
  800a48:	b8 00 00 00 00       	mov    $0x0,%eax
  800a4d:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800a50:	eb 46                	jmp    800a98 <strtol+0x94>
		s++;
  800a52:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800a55:	bf 00 00 00 00       	mov    $0x0,%edi
  800a5a:	eb d5                	jmp    800a31 <strtol+0x2d>
		s++, neg = 1;
  800a5c:	83 c1 01             	add    $0x1,%ecx
  800a5f:	bf 01 00 00 00       	mov    $0x1,%edi
  800a64:	eb cb                	jmp    800a31 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a66:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800a6a:	74 0e                	je     800a7a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800a6c:	85 db                	test   %ebx,%ebx
  800a6e:	75 d8                	jne    800a48 <strtol+0x44>
		s++, base = 8;
  800a70:	83 c1 01             	add    $0x1,%ecx
  800a73:	bb 08 00 00 00       	mov    $0x8,%ebx
  800a78:	eb ce                	jmp    800a48 <strtol+0x44>
		s += 2, base = 16;
  800a7a:	83 c1 02             	add    $0x2,%ecx
  800a7d:	bb 10 00 00 00       	mov    $0x10,%ebx
  800a82:	eb c4                	jmp    800a48 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800a84:	0f be d2             	movsbl %dl,%edx
  800a87:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800a8a:	3b 55 10             	cmp    0x10(%ebp),%edx
  800a8d:	7d 3a                	jge    800ac9 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800a8f:	83 c1 01             	add    $0x1,%ecx
  800a92:	0f af 45 10          	imul   0x10(%ebp),%eax
  800a96:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800a98:	0f b6 11             	movzbl (%ecx),%edx
  800a9b:	8d 72 d0             	lea    -0x30(%edx),%esi
  800a9e:	89 f3                	mov    %esi,%ebx
  800aa0:	80 fb 09             	cmp    $0x9,%bl
  800aa3:	76 df                	jbe    800a84 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800aa5:	8d 72 9f             	lea    -0x61(%edx),%esi
  800aa8:	89 f3                	mov    %esi,%ebx
  800aaa:	80 fb 19             	cmp    $0x19,%bl
  800aad:	77 08                	ja     800ab7 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800aaf:	0f be d2             	movsbl %dl,%edx
  800ab2:	83 ea 57             	sub    $0x57,%edx
  800ab5:	eb d3                	jmp    800a8a <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800ab7:	8d 72 bf             	lea    -0x41(%edx),%esi
  800aba:	89 f3                	mov    %esi,%ebx
  800abc:	80 fb 19             	cmp    $0x19,%bl
  800abf:	77 08                	ja     800ac9 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800ac1:	0f be d2             	movsbl %dl,%edx
  800ac4:	83 ea 37             	sub    $0x37,%edx
  800ac7:	eb c1                	jmp    800a8a <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800ac9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800acd:	74 05                	je     800ad4 <strtol+0xd0>
		*endptr = (char *) s;
  800acf:	8b 75 0c             	mov    0xc(%ebp),%esi
  800ad2:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800ad4:	89 c2                	mov    %eax,%edx
  800ad6:	f7 da                	neg    %edx
  800ad8:	85 ff                	test   %edi,%edi
  800ada:	0f 45 c2             	cmovne %edx,%eax
}
  800add:	5b                   	pop    %ebx
  800ade:	5e                   	pop    %esi
  800adf:	5f                   	pop    %edi
  800ae0:	5d                   	pop    %ebp
  800ae1:	c3                   	ret    

00800ae2 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800ae2:	f3 0f 1e fb          	endbr32 
  800ae6:	55                   	push   %ebp
  800ae7:	89 e5                	mov    %esp,%ebp
  800ae9:	57                   	push   %edi
  800aea:	56                   	push   %esi
  800aeb:	53                   	push   %ebx
	asm volatile("int %1\n"
  800aec:	b8 00 00 00 00       	mov    $0x0,%eax
  800af1:	8b 55 08             	mov    0x8(%ebp),%edx
  800af4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800af7:	89 c3                	mov    %eax,%ebx
  800af9:	89 c7                	mov    %eax,%edi
  800afb:	89 c6                	mov    %eax,%esi
  800afd:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800aff:	5b                   	pop    %ebx
  800b00:	5e                   	pop    %esi
  800b01:	5f                   	pop    %edi
  800b02:	5d                   	pop    %ebp
  800b03:	c3                   	ret    

00800b04 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b04:	f3 0f 1e fb          	endbr32 
  800b08:	55                   	push   %ebp
  800b09:	89 e5                	mov    %esp,%ebp
  800b0b:	57                   	push   %edi
  800b0c:	56                   	push   %esi
  800b0d:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b0e:	ba 00 00 00 00       	mov    $0x0,%edx
  800b13:	b8 01 00 00 00       	mov    $0x1,%eax
  800b18:	89 d1                	mov    %edx,%ecx
  800b1a:	89 d3                	mov    %edx,%ebx
  800b1c:	89 d7                	mov    %edx,%edi
  800b1e:	89 d6                	mov    %edx,%esi
  800b20:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800b22:	5b                   	pop    %ebx
  800b23:	5e                   	pop    %esi
  800b24:	5f                   	pop    %edi
  800b25:	5d                   	pop    %ebp
  800b26:	c3                   	ret    

00800b27 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800b27:	f3 0f 1e fb          	endbr32 
  800b2b:	55                   	push   %ebp
  800b2c:	89 e5                	mov    %esp,%ebp
  800b2e:	57                   	push   %edi
  800b2f:	56                   	push   %esi
  800b30:	53                   	push   %ebx
  800b31:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800b34:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b39:	8b 55 08             	mov    0x8(%ebp),%edx
  800b3c:	b8 03 00 00 00       	mov    $0x3,%eax
  800b41:	89 cb                	mov    %ecx,%ebx
  800b43:	89 cf                	mov    %ecx,%edi
  800b45:	89 ce                	mov    %ecx,%esi
  800b47:	cd 30                	int    $0x30
	if(check && ret > 0)
  800b49:	85 c0                	test   %eax,%eax
  800b4b:	7f 08                	jg     800b55 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800b4d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800b50:	5b                   	pop    %ebx
  800b51:	5e                   	pop    %esi
  800b52:	5f                   	pop    %edi
  800b53:	5d                   	pop    %ebp
  800b54:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800b55:	83 ec 0c             	sub    $0xc,%esp
  800b58:	50                   	push   %eax
  800b59:	6a 03                	push   $0x3
  800b5b:	68 df 22 80 00       	push   $0x8022df
  800b60:	6a 23                	push   $0x23
  800b62:	68 fc 22 80 00       	push   $0x8022fc
  800b67:	e8 3d 10 00 00       	call   801ba9 <_panic>

00800b6c <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800b6c:	f3 0f 1e fb          	endbr32 
  800b70:	55                   	push   %ebp
  800b71:	89 e5                	mov    %esp,%ebp
  800b73:	57                   	push   %edi
  800b74:	56                   	push   %esi
  800b75:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b76:	ba 00 00 00 00       	mov    $0x0,%edx
  800b7b:	b8 02 00 00 00       	mov    $0x2,%eax
  800b80:	89 d1                	mov    %edx,%ecx
  800b82:	89 d3                	mov    %edx,%ebx
  800b84:	89 d7                	mov    %edx,%edi
  800b86:	89 d6                	mov    %edx,%esi
  800b88:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800b8a:	5b                   	pop    %ebx
  800b8b:	5e                   	pop    %esi
  800b8c:	5f                   	pop    %edi
  800b8d:	5d                   	pop    %ebp
  800b8e:	c3                   	ret    

00800b8f <sys_yield>:

void
sys_yield(void)
{
  800b8f:	f3 0f 1e fb          	endbr32 
  800b93:	55                   	push   %ebp
  800b94:	89 e5                	mov    %esp,%ebp
  800b96:	57                   	push   %edi
  800b97:	56                   	push   %esi
  800b98:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b99:	ba 00 00 00 00       	mov    $0x0,%edx
  800b9e:	b8 0b 00 00 00       	mov    $0xb,%eax
  800ba3:	89 d1                	mov    %edx,%ecx
  800ba5:	89 d3                	mov    %edx,%ebx
  800ba7:	89 d7                	mov    %edx,%edi
  800ba9:	89 d6                	mov    %edx,%esi
  800bab:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800bad:	5b                   	pop    %ebx
  800bae:	5e                   	pop    %esi
  800baf:	5f                   	pop    %edi
  800bb0:	5d                   	pop    %ebp
  800bb1:	c3                   	ret    

00800bb2 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800bb2:	f3 0f 1e fb          	endbr32 
  800bb6:	55                   	push   %ebp
  800bb7:	89 e5                	mov    %esp,%ebp
  800bb9:	57                   	push   %edi
  800bba:	56                   	push   %esi
  800bbb:	53                   	push   %ebx
  800bbc:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bbf:	be 00 00 00 00       	mov    $0x0,%esi
  800bc4:	8b 55 08             	mov    0x8(%ebp),%edx
  800bc7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800bca:	b8 04 00 00 00       	mov    $0x4,%eax
  800bcf:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800bd2:	89 f7                	mov    %esi,%edi
  800bd4:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bd6:	85 c0                	test   %eax,%eax
  800bd8:	7f 08                	jg     800be2 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800bda:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800bdd:	5b                   	pop    %ebx
  800bde:	5e                   	pop    %esi
  800bdf:	5f                   	pop    %edi
  800be0:	5d                   	pop    %ebp
  800be1:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800be2:	83 ec 0c             	sub    $0xc,%esp
  800be5:	50                   	push   %eax
  800be6:	6a 04                	push   $0x4
  800be8:	68 df 22 80 00       	push   $0x8022df
  800bed:	6a 23                	push   $0x23
  800bef:	68 fc 22 80 00       	push   $0x8022fc
  800bf4:	e8 b0 0f 00 00       	call   801ba9 <_panic>

00800bf9 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800bf9:	f3 0f 1e fb          	endbr32 
  800bfd:	55                   	push   %ebp
  800bfe:	89 e5                	mov    %esp,%ebp
  800c00:	57                   	push   %edi
  800c01:	56                   	push   %esi
  800c02:	53                   	push   %ebx
  800c03:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c06:	8b 55 08             	mov    0x8(%ebp),%edx
  800c09:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c0c:	b8 05 00 00 00       	mov    $0x5,%eax
  800c11:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c14:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c17:	8b 75 18             	mov    0x18(%ebp),%esi
  800c1a:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c1c:	85 c0                	test   %eax,%eax
  800c1e:	7f 08                	jg     800c28 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c20:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c23:	5b                   	pop    %ebx
  800c24:	5e                   	pop    %esi
  800c25:	5f                   	pop    %edi
  800c26:	5d                   	pop    %ebp
  800c27:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c28:	83 ec 0c             	sub    $0xc,%esp
  800c2b:	50                   	push   %eax
  800c2c:	6a 05                	push   $0x5
  800c2e:	68 df 22 80 00       	push   $0x8022df
  800c33:	6a 23                	push   $0x23
  800c35:	68 fc 22 80 00       	push   $0x8022fc
  800c3a:	e8 6a 0f 00 00       	call   801ba9 <_panic>

00800c3f <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800c3f:	f3 0f 1e fb          	endbr32 
  800c43:	55                   	push   %ebp
  800c44:	89 e5                	mov    %esp,%ebp
  800c46:	57                   	push   %edi
  800c47:	56                   	push   %esi
  800c48:	53                   	push   %ebx
  800c49:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c4c:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c51:	8b 55 08             	mov    0x8(%ebp),%edx
  800c54:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c57:	b8 06 00 00 00       	mov    $0x6,%eax
  800c5c:	89 df                	mov    %ebx,%edi
  800c5e:	89 de                	mov    %ebx,%esi
  800c60:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c62:	85 c0                	test   %eax,%eax
  800c64:	7f 08                	jg     800c6e <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800c66:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c69:	5b                   	pop    %ebx
  800c6a:	5e                   	pop    %esi
  800c6b:	5f                   	pop    %edi
  800c6c:	5d                   	pop    %ebp
  800c6d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c6e:	83 ec 0c             	sub    $0xc,%esp
  800c71:	50                   	push   %eax
  800c72:	6a 06                	push   $0x6
  800c74:	68 df 22 80 00       	push   $0x8022df
  800c79:	6a 23                	push   $0x23
  800c7b:	68 fc 22 80 00       	push   $0x8022fc
  800c80:	e8 24 0f 00 00       	call   801ba9 <_panic>

00800c85 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800c85:	f3 0f 1e fb          	endbr32 
  800c89:	55                   	push   %ebp
  800c8a:	89 e5                	mov    %esp,%ebp
  800c8c:	57                   	push   %edi
  800c8d:	56                   	push   %esi
  800c8e:	53                   	push   %ebx
  800c8f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c92:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c97:	8b 55 08             	mov    0x8(%ebp),%edx
  800c9a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c9d:	b8 08 00 00 00       	mov    $0x8,%eax
  800ca2:	89 df                	mov    %ebx,%edi
  800ca4:	89 de                	mov    %ebx,%esi
  800ca6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ca8:	85 c0                	test   %eax,%eax
  800caa:	7f 08                	jg     800cb4 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800cac:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800caf:	5b                   	pop    %ebx
  800cb0:	5e                   	pop    %esi
  800cb1:	5f                   	pop    %edi
  800cb2:	5d                   	pop    %ebp
  800cb3:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cb4:	83 ec 0c             	sub    $0xc,%esp
  800cb7:	50                   	push   %eax
  800cb8:	6a 08                	push   $0x8
  800cba:	68 df 22 80 00       	push   $0x8022df
  800cbf:	6a 23                	push   $0x23
  800cc1:	68 fc 22 80 00       	push   $0x8022fc
  800cc6:	e8 de 0e 00 00       	call   801ba9 <_panic>

00800ccb <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800ccb:	f3 0f 1e fb          	endbr32 
  800ccf:	55                   	push   %ebp
  800cd0:	89 e5                	mov    %esp,%ebp
  800cd2:	57                   	push   %edi
  800cd3:	56                   	push   %esi
  800cd4:	53                   	push   %ebx
  800cd5:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cd8:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cdd:	8b 55 08             	mov    0x8(%ebp),%edx
  800ce0:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ce3:	b8 09 00 00 00       	mov    $0x9,%eax
  800ce8:	89 df                	mov    %ebx,%edi
  800cea:	89 de                	mov    %ebx,%esi
  800cec:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cee:	85 c0                	test   %eax,%eax
  800cf0:	7f 08                	jg     800cfa <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800cf2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cf5:	5b                   	pop    %ebx
  800cf6:	5e                   	pop    %esi
  800cf7:	5f                   	pop    %edi
  800cf8:	5d                   	pop    %ebp
  800cf9:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cfa:	83 ec 0c             	sub    $0xc,%esp
  800cfd:	50                   	push   %eax
  800cfe:	6a 09                	push   $0x9
  800d00:	68 df 22 80 00       	push   $0x8022df
  800d05:	6a 23                	push   $0x23
  800d07:	68 fc 22 80 00       	push   $0x8022fc
  800d0c:	e8 98 0e 00 00       	call   801ba9 <_panic>

00800d11 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d11:	f3 0f 1e fb          	endbr32 
  800d15:	55                   	push   %ebp
  800d16:	89 e5                	mov    %esp,%ebp
  800d18:	57                   	push   %edi
  800d19:	56                   	push   %esi
  800d1a:	53                   	push   %ebx
  800d1b:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d1e:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d23:	8b 55 08             	mov    0x8(%ebp),%edx
  800d26:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d29:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d2e:	89 df                	mov    %ebx,%edi
  800d30:	89 de                	mov    %ebx,%esi
  800d32:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d34:	85 c0                	test   %eax,%eax
  800d36:	7f 08                	jg     800d40 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800d38:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d3b:	5b                   	pop    %ebx
  800d3c:	5e                   	pop    %esi
  800d3d:	5f                   	pop    %edi
  800d3e:	5d                   	pop    %ebp
  800d3f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d40:	83 ec 0c             	sub    $0xc,%esp
  800d43:	50                   	push   %eax
  800d44:	6a 0a                	push   $0xa
  800d46:	68 df 22 80 00       	push   $0x8022df
  800d4b:	6a 23                	push   $0x23
  800d4d:	68 fc 22 80 00       	push   $0x8022fc
  800d52:	e8 52 0e 00 00       	call   801ba9 <_panic>

00800d57 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800d57:	f3 0f 1e fb          	endbr32 
  800d5b:	55                   	push   %ebp
  800d5c:	89 e5                	mov    %esp,%ebp
  800d5e:	57                   	push   %edi
  800d5f:	56                   	push   %esi
  800d60:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d61:	8b 55 08             	mov    0x8(%ebp),%edx
  800d64:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d67:	b8 0c 00 00 00       	mov    $0xc,%eax
  800d6c:	be 00 00 00 00       	mov    $0x0,%esi
  800d71:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d74:	8b 7d 14             	mov    0x14(%ebp),%edi
  800d77:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800d79:	5b                   	pop    %ebx
  800d7a:	5e                   	pop    %esi
  800d7b:	5f                   	pop    %edi
  800d7c:	5d                   	pop    %ebp
  800d7d:	c3                   	ret    

00800d7e <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800d7e:	f3 0f 1e fb          	endbr32 
  800d82:	55                   	push   %ebp
  800d83:	89 e5                	mov    %esp,%ebp
  800d85:	57                   	push   %edi
  800d86:	56                   	push   %esi
  800d87:	53                   	push   %ebx
  800d88:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d8b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800d90:	8b 55 08             	mov    0x8(%ebp),%edx
  800d93:	b8 0d 00 00 00       	mov    $0xd,%eax
  800d98:	89 cb                	mov    %ecx,%ebx
  800d9a:	89 cf                	mov    %ecx,%edi
  800d9c:	89 ce                	mov    %ecx,%esi
  800d9e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800da0:	85 c0                	test   %eax,%eax
  800da2:	7f 08                	jg     800dac <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800da4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800da7:	5b                   	pop    %ebx
  800da8:	5e                   	pop    %esi
  800da9:	5f                   	pop    %edi
  800daa:	5d                   	pop    %ebp
  800dab:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dac:	83 ec 0c             	sub    $0xc,%esp
  800daf:	50                   	push   %eax
  800db0:	6a 0d                	push   $0xd
  800db2:	68 df 22 80 00       	push   $0x8022df
  800db7:	6a 23                	push   $0x23
  800db9:	68 fc 22 80 00       	push   $0x8022fc
  800dbe:	e8 e6 0d 00 00       	call   801ba9 <_panic>

00800dc3 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  800dc3:	f3 0f 1e fb          	endbr32 
  800dc7:	55                   	push   %ebp
  800dc8:	89 e5                	mov    %esp,%ebp
  800dca:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  800dcd:	83 3d 08 40 80 00 00 	cmpl   $0x0,0x804008
  800dd4:	74 27                	je     800dfd <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  800dd6:	8b 45 08             	mov    0x8(%ebp),%eax
  800dd9:	a3 08 40 80 00       	mov    %eax,0x804008
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  800dde:	a1 04 40 80 00       	mov    0x804004,%eax
  800de3:	8b 40 48             	mov    0x48(%eax),%eax
  800de6:	83 ec 08             	sub    $0x8,%esp
  800de9:	68 3d 0e 80 00       	push   $0x800e3d
  800dee:	50                   	push   %eax
  800def:	e8 1d ff ff ff       	call   800d11 <sys_env_set_pgfault_upcall>
  800df4:	83 c4 10             	add    $0x10,%esp
  800df7:	85 c0                	test   %eax,%eax
  800df9:	78 2e                	js     800e29 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  800dfb:	c9                   	leave  
  800dfc:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  800dfd:	83 ec 04             	sub    $0x4,%esp
  800e00:	6a 07                	push   $0x7
  800e02:	68 00 f0 bf ee       	push   $0xeebff000
  800e07:	6a 00                	push   $0x0
  800e09:	e8 a4 fd ff ff       	call   800bb2 <sys_page_alloc>
  800e0e:	83 c4 10             	add    $0x10,%esp
  800e11:	85 c0                	test   %eax,%eax
  800e13:	79 c1                	jns    800dd6 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  800e15:	83 ec 04             	sub    $0x4,%esp
  800e18:	68 0c 23 80 00       	push   $0x80230c
  800e1d:	6a 21                	push   $0x21
  800e1f:	68 6e 23 80 00       	push   $0x80236e
  800e24:	e8 80 0d 00 00       	call   801ba9 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  800e29:	83 ec 04             	sub    $0x4,%esp
  800e2c:	68 38 23 80 00       	push   $0x802338
  800e31:	6a 27                	push   $0x27
  800e33:	68 6e 23 80 00       	push   $0x80236e
  800e38:	e8 6c 0d 00 00       	call   801ba9 <_panic>

00800e3d <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  800e3d:	54                   	push   %esp
	movl _pgfault_handler, %eax
  800e3e:	a1 08 40 80 00       	mov    0x804008,%eax
	call *%eax
  800e43:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  800e45:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  800e48:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  800e4c:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  800e4f:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  800e53:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  800e57:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  800e5a:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  800e5d:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  800e5e:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  800e61:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  800e62:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  800e63:	c3                   	ret    

00800e64 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800e64:	f3 0f 1e fb          	endbr32 
  800e68:	55                   	push   %ebp
  800e69:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800e6b:	8b 45 08             	mov    0x8(%ebp),%eax
  800e6e:	05 00 00 00 30       	add    $0x30000000,%eax
  800e73:	c1 e8 0c             	shr    $0xc,%eax
}
  800e76:	5d                   	pop    %ebp
  800e77:	c3                   	ret    

00800e78 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800e78:	f3 0f 1e fb          	endbr32 
  800e7c:	55                   	push   %ebp
  800e7d:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800e7f:	8b 45 08             	mov    0x8(%ebp),%eax
  800e82:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800e87:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800e8c:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800e91:	5d                   	pop    %ebp
  800e92:	c3                   	ret    

00800e93 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800e93:	f3 0f 1e fb          	endbr32 
  800e97:	55                   	push   %ebp
  800e98:	89 e5                	mov    %esp,%ebp
  800e9a:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800e9f:	89 c2                	mov    %eax,%edx
  800ea1:	c1 ea 16             	shr    $0x16,%edx
  800ea4:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800eab:	f6 c2 01             	test   $0x1,%dl
  800eae:	74 2d                	je     800edd <fd_alloc+0x4a>
  800eb0:	89 c2                	mov    %eax,%edx
  800eb2:	c1 ea 0c             	shr    $0xc,%edx
  800eb5:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800ebc:	f6 c2 01             	test   $0x1,%dl
  800ebf:	74 1c                	je     800edd <fd_alloc+0x4a>
  800ec1:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  800ec6:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  800ecb:	75 d2                	jne    800e9f <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  800ecd:	8b 45 08             	mov    0x8(%ebp),%eax
  800ed0:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  800ed6:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  800edb:	eb 0a                	jmp    800ee7 <fd_alloc+0x54>
			*fd_store = fd;
  800edd:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800ee0:	89 01                	mov    %eax,(%ecx)
			return 0;
  800ee2:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800ee7:	5d                   	pop    %ebp
  800ee8:	c3                   	ret    

00800ee9 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  800ee9:	f3 0f 1e fb          	endbr32 
  800eed:	55                   	push   %ebp
  800eee:	89 e5                	mov    %esp,%ebp
  800ef0:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  800ef3:	83 f8 1f             	cmp    $0x1f,%eax
  800ef6:	77 30                	ja     800f28 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  800ef8:	c1 e0 0c             	shl    $0xc,%eax
  800efb:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  800f00:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  800f06:	f6 c2 01             	test   $0x1,%dl
  800f09:	74 24                	je     800f2f <fd_lookup+0x46>
  800f0b:	89 c2                	mov    %eax,%edx
  800f0d:	c1 ea 0c             	shr    $0xc,%edx
  800f10:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800f17:	f6 c2 01             	test   $0x1,%dl
  800f1a:	74 1a                	je     800f36 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  800f1c:	8b 55 0c             	mov    0xc(%ebp),%edx
  800f1f:	89 02                	mov    %eax,(%edx)
	return 0;
  800f21:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800f26:	5d                   	pop    %ebp
  800f27:	c3                   	ret    
		return -E_INVAL;
  800f28:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800f2d:	eb f7                	jmp    800f26 <fd_lookup+0x3d>
		return -E_INVAL;
  800f2f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800f34:	eb f0                	jmp    800f26 <fd_lookup+0x3d>
  800f36:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800f3b:	eb e9                	jmp    800f26 <fd_lookup+0x3d>

00800f3d <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  800f3d:	f3 0f 1e fb          	endbr32 
  800f41:	55                   	push   %ebp
  800f42:	89 e5                	mov    %esp,%ebp
  800f44:	83 ec 08             	sub    $0x8,%esp
  800f47:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800f4a:	ba f8 23 80 00       	mov    $0x8023f8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  800f4f:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  800f54:	39 08                	cmp    %ecx,(%eax)
  800f56:	74 33                	je     800f8b <dev_lookup+0x4e>
  800f58:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  800f5b:	8b 02                	mov    (%edx),%eax
  800f5d:	85 c0                	test   %eax,%eax
  800f5f:	75 f3                	jne    800f54 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  800f61:	a1 04 40 80 00       	mov    0x804004,%eax
  800f66:	8b 40 48             	mov    0x48(%eax),%eax
  800f69:	83 ec 04             	sub    $0x4,%esp
  800f6c:	51                   	push   %ecx
  800f6d:	50                   	push   %eax
  800f6e:	68 7c 23 80 00       	push   $0x80237c
  800f73:	e8 1f f2 ff ff       	call   800197 <cprintf>
	*dev = 0;
  800f78:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f7b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  800f81:	83 c4 10             	add    $0x10,%esp
  800f84:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  800f89:	c9                   	leave  
  800f8a:	c3                   	ret    
			*dev = devtab[i];
  800f8b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f8e:	89 01                	mov    %eax,(%ecx)
			return 0;
  800f90:	b8 00 00 00 00       	mov    $0x0,%eax
  800f95:	eb f2                	jmp    800f89 <dev_lookup+0x4c>

00800f97 <fd_close>:
{
  800f97:	f3 0f 1e fb          	endbr32 
  800f9b:	55                   	push   %ebp
  800f9c:	89 e5                	mov    %esp,%ebp
  800f9e:	57                   	push   %edi
  800f9f:	56                   	push   %esi
  800fa0:	53                   	push   %ebx
  800fa1:	83 ec 24             	sub    $0x24,%esp
  800fa4:	8b 75 08             	mov    0x8(%ebp),%esi
  800fa7:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  800faa:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  800fad:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800fae:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  800fb4:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  800fb7:	50                   	push   %eax
  800fb8:	e8 2c ff ff ff       	call   800ee9 <fd_lookup>
  800fbd:	89 c3                	mov    %eax,%ebx
  800fbf:	83 c4 10             	add    $0x10,%esp
  800fc2:	85 c0                	test   %eax,%eax
  800fc4:	78 05                	js     800fcb <fd_close+0x34>
	    || fd != fd2)
  800fc6:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  800fc9:	74 16                	je     800fe1 <fd_close+0x4a>
		return (must_exist ? r : 0);
  800fcb:	89 f8                	mov    %edi,%eax
  800fcd:	84 c0                	test   %al,%al
  800fcf:	b8 00 00 00 00       	mov    $0x0,%eax
  800fd4:	0f 44 d8             	cmove  %eax,%ebx
}
  800fd7:	89 d8                	mov    %ebx,%eax
  800fd9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800fdc:	5b                   	pop    %ebx
  800fdd:	5e                   	pop    %esi
  800fde:	5f                   	pop    %edi
  800fdf:	5d                   	pop    %ebp
  800fe0:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  800fe1:	83 ec 08             	sub    $0x8,%esp
  800fe4:	8d 45 e0             	lea    -0x20(%ebp),%eax
  800fe7:	50                   	push   %eax
  800fe8:	ff 36                	pushl  (%esi)
  800fea:	e8 4e ff ff ff       	call   800f3d <dev_lookup>
  800fef:	89 c3                	mov    %eax,%ebx
  800ff1:	83 c4 10             	add    $0x10,%esp
  800ff4:	85 c0                	test   %eax,%eax
  800ff6:	78 1a                	js     801012 <fd_close+0x7b>
		if (dev->dev_close)
  800ff8:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800ffb:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  800ffe:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801003:	85 c0                	test   %eax,%eax
  801005:	74 0b                	je     801012 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801007:	83 ec 0c             	sub    $0xc,%esp
  80100a:	56                   	push   %esi
  80100b:	ff d0                	call   *%eax
  80100d:	89 c3                	mov    %eax,%ebx
  80100f:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801012:	83 ec 08             	sub    $0x8,%esp
  801015:	56                   	push   %esi
  801016:	6a 00                	push   $0x0
  801018:	e8 22 fc ff ff       	call   800c3f <sys_page_unmap>
	return r;
  80101d:	83 c4 10             	add    $0x10,%esp
  801020:	eb b5                	jmp    800fd7 <fd_close+0x40>

00801022 <close>:

int
close(int fdnum)
{
  801022:	f3 0f 1e fb          	endbr32 
  801026:	55                   	push   %ebp
  801027:	89 e5                	mov    %esp,%ebp
  801029:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80102c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80102f:	50                   	push   %eax
  801030:	ff 75 08             	pushl  0x8(%ebp)
  801033:	e8 b1 fe ff ff       	call   800ee9 <fd_lookup>
  801038:	83 c4 10             	add    $0x10,%esp
  80103b:	85 c0                	test   %eax,%eax
  80103d:	79 02                	jns    801041 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  80103f:	c9                   	leave  
  801040:	c3                   	ret    
		return fd_close(fd, 1);
  801041:	83 ec 08             	sub    $0x8,%esp
  801044:	6a 01                	push   $0x1
  801046:	ff 75 f4             	pushl  -0xc(%ebp)
  801049:	e8 49 ff ff ff       	call   800f97 <fd_close>
  80104e:	83 c4 10             	add    $0x10,%esp
  801051:	eb ec                	jmp    80103f <close+0x1d>

00801053 <close_all>:

void
close_all(void)
{
  801053:	f3 0f 1e fb          	endbr32 
  801057:	55                   	push   %ebp
  801058:	89 e5                	mov    %esp,%ebp
  80105a:	53                   	push   %ebx
  80105b:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  80105e:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801063:	83 ec 0c             	sub    $0xc,%esp
  801066:	53                   	push   %ebx
  801067:	e8 b6 ff ff ff       	call   801022 <close>
	for (i = 0; i < MAXFD; i++)
  80106c:	83 c3 01             	add    $0x1,%ebx
  80106f:	83 c4 10             	add    $0x10,%esp
  801072:	83 fb 20             	cmp    $0x20,%ebx
  801075:	75 ec                	jne    801063 <close_all+0x10>
}
  801077:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80107a:	c9                   	leave  
  80107b:	c3                   	ret    

0080107c <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80107c:	f3 0f 1e fb          	endbr32 
  801080:	55                   	push   %ebp
  801081:	89 e5                	mov    %esp,%ebp
  801083:	57                   	push   %edi
  801084:	56                   	push   %esi
  801085:	53                   	push   %ebx
  801086:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801089:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80108c:	50                   	push   %eax
  80108d:	ff 75 08             	pushl  0x8(%ebp)
  801090:	e8 54 fe ff ff       	call   800ee9 <fd_lookup>
  801095:	89 c3                	mov    %eax,%ebx
  801097:	83 c4 10             	add    $0x10,%esp
  80109a:	85 c0                	test   %eax,%eax
  80109c:	0f 88 81 00 00 00    	js     801123 <dup+0xa7>
		return r;
	close(newfdnum);
  8010a2:	83 ec 0c             	sub    $0xc,%esp
  8010a5:	ff 75 0c             	pushl  0xc(%ebp)
  8010a8:	e8 75 ff ff ff       	call   801022 <close>

	newfd = INDEX2FD(newfdnum);
  8010ad:	8b 75 0c             	mov    0xc(%ebp),%esi
  8010b0:	c1 e6 0c             	shl    $0xc,%esi
  8010b3:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8010b9:	83 c4 04             	add    $0x4,%esp
  8010bc:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010bf:	e8 b4 fd ff ff       	call   800e78 <fd2data>
  8010c4:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8010c6:	89 34 24             	mov    %esi,(%esp)
  8010c9:	e8 aa fd ff ff       	call   800e78 <fd2data>
  8010ce:	83 c4 10             	add    $0x10,%esp
  8010d1:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8010d3:	89 d8                	mov    %ebx,%eax
  8010d5:	c1 e8 16             	shr    $0x16,%eax
  8010d8:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8010df:	a8 01                	test   $0x1,%al
  8010e1:	74 11                	je     8010f4 <dup+0x78>
  8010e3:	89 d8                	mov    %ebx,%eax
  8010e5:	c1 e8 0c             	shr    $0xc,%eax
  8010e8:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8010ef:	f6 c2 01             	test   $0x1,%dl
  8010f2:	75 39                	jne    80112d <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8010f4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8010f7:	89 d0                	mov    %edx,%eax
  8010f9:	c1 e8 0c             	shr    $0xc,%eax
  8010fc:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801103:	83 ec 0c             	sub    $0xc,%esp
  801106:	25 07 0e 00 00       	and    $0xe07,%eax
  80110b:	50                   	push   %eax
  80110c:	56                   	push   %esi
  80110d:	6a 00                	push   $0x0
  80110f:	52                   	push   %edx
  801110:	6a 00                	push   $0x0
  801112:	e8 e2 fa ff ff       	call   800bf9 <sys_page_map>
  801117:	89 c3                	mov    %eax,%ebx
  801119:	83 c4 20             	add    $0x20,%esp
  80111c:	85 c0                	test   %eax,%eax
  80111e:	78 31                	js     801151 <dup+0xd5>
		goto err;

	return newfdnum;
  801120:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801123:	89 d8                	mov    %ebx,%eax
  801125:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801128:	5b                   	pop    %ebx
  801129:	5e                   	pop    %esi
  80112a:	5f                   	pop    %edi
  80112b:	5d                   	pop    %ebp
  80112c:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  80112d:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801134:	83 ec 0c             	sub    $0xc,%esp
  801137:	25 07 0e 00 00       	and    $0xe07,%eax
  80113c:	50                   	push   %eax
  80113d:	57                   	push   %edi
  80113e:	6a 00                	push   $0x0
  801140:	53                   	push   %ebx
  801141:	6a 00                	push   $0x0
  801143:	e8 b1 fa ff ff       	call   800bf9 <sys_page_map>
  801148:	89 c3                	mov    %eax,%ebx
  80114a:	83 c4 20             	add    $0x20,%esp
  80114d:	85 c0                	test   %eax,%eax
  80114f:	79 a3                	jns    8010f4 <dup+0x78>
	sys_page_unmap(0, newfd);
  801151:	83 ec 08             	sub    $0x8,%esp
  801154:	56                   	push   %esi
  801155:	6a 00                	push   $0x0
  801157:	e8 e3 fa ff ff       	call   800c3f <sys_page_unmap>
	sys_page_unmap(0, nva);
  80115c:	83 c4 08             	add    $0x8,%esp
  80115f:	57                   	push   %edi
  801160:	6a 00                	push   $0x0
  801162:	e8 d8 fa ff ff       	call   800c3f <sys_page_unmap>
	return r;
  801167:	83 c4 10             	add    $0x10,%esp
  80116a:	eb b7                	jmp    801123 <dup+0xa7>

0080116c <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80116c:	f3 0f 1e fb          	endbr32 
  801170:	55                   	push   %ebp
  801171:	89 e5                	mov    %esp,%ebp
  801173:	53                   	push   %ebx
  801174:	83 ec 1c             	sub    $0x1c,%esp
  801177:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80117a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80117d:	50                   	push   %eax
  80117e:	53                   	push   %ebx
  80117f:	e8 65 fd ff ff       	call   800ee9 <fd_lookup>
  801184:	83 c4 10             	add    $0x10,%esp
  801187:	85 c0                	test   %eax,%eax
  801189:	78 3f                	js     8011ca <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80118b:	83 ec 08             	sub    $0x8,%esp
  80118e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801191:	50                   	push   %eax
  801192:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801195:	ff 30                	pushl  (%eax)
  801197:	e8 a1 fd ff ff       	call   800f3d <dev_lookup>
  80119c:	83 c4 10             	add    $0x10,%esp
  80119f:	85 c0                	test   %eax,%eax
  8011a1:	78 27                	js     8011ca <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8011a3:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8011a6:	8b 42 08             	mov    0x8(%edx),%eax
  8011a9:	83 e0 03             	and    $0x3,%eax
  8011ac:	83 f8 01             	cmp    $0x1,%eax
  8011af:	74 1e                	je     8011cf <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8011b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8011b4:	8b 40 08             	mov    0x8(%eax),%eax
  8011b7:	85 c0                	test   %eax,%eax
  8011b9:	74 35                	je     8011f0 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8011bb:	83 ec 04             	sub    $0x4,%esp
  8011be:	ff 75 10             	pushl  0x10(%ebp)
  8011c1:	ff 75 0c             	pushl  0xc(%ebp)
  8011c4:	52                   	push   %edx
  8011c5:	ff d0                	call   *%eax
  8011c7:	83 c4 10             	add    $0x10,%esp
}
  8011ca:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8011cd:	c9                   	leave  
  8011ce:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8011cf:	a1 04 40 80 00       	mov    0x804004,%eax
  8011d4:	8b 40 48             	mov    0x48(%eax),%eax
  8011d7:	83 ec 04             	sub    $0x4,%esp
  8011da:	53                   	push   %ebx
  8011db:	50                   	push   %eax
  8011dc:	68 bd 23 80 00       	push   $0x8023bd
  8011e1:	e8 b1 ef ff ff       	call   800197 <cprintf>
		return -E_INVAL;
  8011e6:	83 c4 10             	add    $0x10,%esp
  8011e9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8011ee:	eb da                	jmp    8011ca <read+0x5e>
		return -E_NOT_SUPP;
  8011f0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8011f5:	eb d3                	jmp    8011ca <read+0x5e>

008011f7 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8011f7:	f3 0f 1e fb          	endbr32 
  8011fb:	55                   	push   %ebp
  8011fc:	89 e5                	mov    %esp,%ebp
  8011fe:	57                   	push   %edi
  8011ff:	56                   	push   %esi
  801200:	53                   	push   %ebx
  801201:	83 ec 0c             	sub    $0xc,%esp
  801204:	8b 7d 08             	mov    0x8(%ebp),%edi
  801207:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  80120a:	bb 00 00 00 00       	mov    $0x0,%ebx
  80120f:	eb 02                	jmp    801213 <readn+0x1c>
  801211:	01 c3                	add    %eax,%ebx
  801213:	39 f3                	cmp    %esi,%ebx
  801215:	73 21                	jae    801238 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801217:	83 ec 04             	sub    $0x4,%esp
  80121a:	89 f0                	mov    %esi,%eax
  80121c:	29 d8                	sub    %ebx,%eax
  80121e:	50                   	push   %eax
  80121f:	89 d8                	mov    %ebx,%eax
  801221:	03 45 0c             	add    0xc(%ebp),%eax
  801224:	50                   	push   %eax
  801225:	57                   	push   %edi
  801226:	e8 41 ff ff ff       	call   80116c <read>
		if (m < 0)
  80122b:	83 c4 10             	add    $0x10,%esp
  80122e:	85 c0                	test   %eax,%eax
  801230:	78 04                	js     801236 <readn+0x3f>
			return m;
		if (m == 0)
  801232:	75 dd                	jne    801211 <readn+0x1a>
  801234:	eb 02                	jmp    801238 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801236:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801238:	89 d8                	mov    %ebx,%eax
  80123a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80123d:	5b                   	pop    %ebx
  80123e:	5e                   	pop    %esi
  80123f:	5f                   	pop    %edi
  801240:	5d                   	pop    %ebp
  801241:	c3                   	ret    

00801242 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801242:	f3 0f 1e fb          	endbr32 
  801246:	55                   	push   %ebp
  801247:	89 e5                	mov    %esp,%ebp
  801249:	53                   	push   %ebx
  80124a:	83 ec 1c             	sub    $0x1c,%esp
  80124d:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801250:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801253:	50                   	push   %eax
  801254:	53                   	push   %ebx
  801255:	e8 8f fc ff ff       	call   800ee9 <fd_lookup>
  80125a:	83 c4 10             	add    $0x10,%esp
  80125d:	85 c0                	test   %eax,%eax
  80125f:	78 3a                	js     80129b <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801261:	83 ec 08             	sub    $0x8,%esp
  801264:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801267:	50                   	push   %eax
  801268:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80126b:	ff 30                	pushl  (%eax)
  80126d:	e8 cb fc ff ff       	call   800f3d <dev_lookup>
  801272:	83 c4 10             	add    $0x10,%esp
  801275:	85 c0                	test   %eax,%eax
  801277:	78 22                	js     80129b <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801279:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80127c:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801280:	74 1e                	je     8012a0 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801282:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801285:	8b 52 0c             	mov    0xc(%edx),%edx
  801288:	85 d2                	test   %edx,%edx
  80128a:	74 35                	je     8012c1 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80128c:	83 ec 04             	sub    $0x4,%esp
  80128f:	ff 75 10             	pushl  0x10(%ebp)
  801292:	ff 75 0c             	pushl  0xc(%ebp)
  801295:	50                   	push   %eax
  801296:	ff d2                	call   *%edx
  801298:	83 c4 10             	add    $0x10,%esp
}
  80129b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80129e:	c9                   	leave  
  80129f:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8012a0:	a1 04 40 80 00       	mov    0x804004,%eax
  8012a5:	8b 40 48             	mov    0x48(%eax),%eax
  8012a8:	83 ec 04             	sub    $0x4,%esp
  8012ab:	53                   	push   %ebx
  8012ac:	50                   	push   %eax
  8012ad:	68 d9 23 80 00       	push   $0x8023d9
  8012b2:	e8 e0 ee ff ff       	call   800197 <cprintf>
		return -E_INVAL;
  8012b7:	83 c4 10             	add    $0x10,%esp
  8012ba:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8012bf:	eb da                	jmp    80129b <write+0x59>
		return -E_NOT_SUPP;
  8012c1:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8012c6:	eb d3                	jmp    80129b <write+0x59>

008012c8 <seek>:

int
seek(int fdnum, off_t offset)
{
  8012c8:	f3 0f 1e fb          	endbr32 
  8012cc:	55                   	push   %ebp
  8012cd:	89 e5                	mov    %esp,%ebp
  8012cf:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8012d2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8012d5:	50                   	push   %eax
  8012d6:	ff 75 08             	pushl  0x8(%ebp)
  8012d9:	e8 0b fc ff ff       	call   800ee9 <fd_lookup>
  8012de:	83 c4 10             	add    $0x10,%esp
  8012e1:	85 c0                	test   %eax,%eax
  8012e3:	78 0e                	js     8012f3 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8012e5:	8b 55 0c             	mov    0xc(%ebp),%edx
  8012e8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8012eb:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8012ee:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8012f3:	c9                   	leave  
  8012f4:	c3                   	ret    

008012f5 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8012f5:	f3 0f 1e fb          	endbr32 
  8012f9:	55                   	push   %ebp
  8012fa:	89 e5                	mov    %esp,%ebp
  8012fc:	53                   	push   %ebx
  8012fd:	83 ec 1c             	sub    $0x1c,%esp
  801300:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801303:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801306:	50                   	push   %eax
  801307:	53                   	push   %ebx
  801308:	e8 dc fb ff ff       	call   800ee9 <fd_lookup>
  80130d:	83 c4 10             	add    $0x10,%esp
  801310:	85 c0                	test   %eax,%eax
  801312:	78 37                	js     80134b <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801314:	83 ec 08             	sub    $0x8,%esp
  801317:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80131a:	50                   	push   %eax
  80131b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80131e:	ff 30                	pushl  (%eax)
  801320:	e8 18 fc ff ff       	call   800f3d <dev_lookup>
  801325:	83 c4 10             	add    $0x10,%esp
  801328:	85 c0                	test   %eax,%eax
  80132a:	78 1f                	js     80134b <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80132c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80132f:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801333:	74 1b                	je     801350 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801335:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801338:	8b 52 18             	mov    0x18(%edx),%edx
  80133b:	85 d2                	test   %edx,%edx
  80133d:	74 32                	je     801371 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  80133f:	83 ec 08             	sub    $0x8,%esp
  801342:	ff 75 0c             	pushl  0xc(%ebp)
  801345:	50                   	push   %eax
  801346:	ff d2                	call   *%edx
  801348:	83 c4 10             	add    $0x10,%esp
}
  80134b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80134e:	c9                   	leave  
  80134f:	c3                   	ret    
			thisenv->env_id, fdnum);
  801350:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801355:	8b 40 48             	mov    0x48(%eax),%eax
  801358:	83 ec 04             	sub    $0x4,%esp
  80135b:	53                   	push   %ebx
  80135c:	50                   	push   %eax
  80135d:	68 9c 23 80 00       	push   $0x80239c
  801362:	e8 30 ee ff ff       	call   800197 <cprintf>
		return -E_INVAL;
  801367:	83 c4 10             	add    $0x10,%esp
  80136a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80136f:	eb da                	jmp    80134b <ftruncate+0x56>
		return -E_NOT_SUPP;
  801371:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801376:	eb d3                	jmp    80134b <ftruncate+0x56>

00801378 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801378:	f3 0f 1e fb          	endbr32 
  80137c:	55                   	push   %ebp
  80137d:	89 e5                	mov    %esp,%ebp
  80137f:	53                   	push   %ebx
  801380:	83 ec 1c             	sub    $0x1c,%esp
  801383:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801386:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801389:	50                   	push   %eax
  80138a:	ff 75 08             	pushl  0x8(%ebp)
  80138d:	e8 57 fb ff ff       	call   800ee9 <fd_lookup>
  801392:	83 c4 10             	add    $0x10,%esp
  801395:	85 c0                	test   %eax,%eax
  801397:	78 4b                	js     8013e4 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801399:	83 ec 08             	sub    $0x8,%esp
  80139c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80139f:	50                   	push   %eax
  8013a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013a3:	ff 30                	pushl  (%eax)
  8013a5:	e8 93 fb ff ff       	call   800f3d <dev_lookup>
  8013aa:	83 c4 10             	add    $0x10,%esp
  8013ad:	85 c0                	test   %eax,%eax
  8013af:	78 33                	js     8013e4 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8013b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8013b4:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8013b8:	74 2f                	je     8013e9 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8013ba:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8013bd:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8013c4:	00 00 00 
	stat->st_isdir = 0;
  8013c7:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8013ce:	00 00 00 
	stat->st_dev = dev;
  8013d1:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8013d7:	83 ec 08             	sub    $0x8,%esp
  8013da:	53                   	push   %ebx
  8013db:	ff 75 f0             	pushl  -0x10(%ebp)
  8013de:	ff 50 14             	call   *0x14(%eax)
  8013e1:	83 c4 10             	add    $0x10,%esp
}
  8013e4:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013e7:	c9                   	leave  
  8013e8:	c3                   	ret    
		return -E_NOT_SUPP;
  8013e9:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8013ee:	eb f4                	jmp    8013e4 <fstat+0x6c>

008013f0 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8013f0:	f3 0f 1e fb          	endbr32 
  8013f4:	55                   	push   %ebp
  8013f5:	89 e5                	mov    %esp,%ebp
  8013f7:	56                   	push   %esi
  8013f8:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8013f9:	83 ec 08             	sub    $0x8,%esp
  8013fc:	6a 00                	push   $0x0
  8013fe:	ff 75 08             	pushl  0x8(%ebp)
  801401:	e8 fb 01 00 00       	call   801601 <open>
  801406:	89 c3                	mov    %eax,%ebx
  801408:	83 c4 10             	add    $0x10,%esp
  80140b:	85 c0                	test   %eax,%eax
  80140d:	78 1b                	js     80142a <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  80140f:	83 ec 08             	sub    $0x8,%esp
  801412:	ff 75 0c             	pushl  0xc(%ebp)
  801415:	50                   	push   %eax
  801416:	e8 5d ff ff ff       	call   801378 <fstat>
  80141b:	89 c6                	mov    %eax,%esi
	close(fd);
  80141d:	89 1c 24             	mov    %ebx,(%esp)
  801420:	e8 fd fb ff ff       	call   801022 <close>
	return r;
  801425:	83 c4 10             	add    $0x10,%esp
  801428:	89 f3                	mov    %esi,%ebx
}
  80142a:	89 d8                	mov    %ebx,%eax
  80142c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80142f:	5b                   	pop    %ebx
  801430:	5e                   	pop    %esi
  801431:	5d                   	pop    %ebp
  801432:	c3                   	ret    

00801433 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801433:	55                   	push   %ebp
  801434:	89 e5                	mov    %esp,%ebp
  801436:	56                   	push   %esi
  801437:	53                   	push   %ebx
  801438:	89 c6                	mov    %eax,%esi
  80143a:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80143c:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801443:	74 27                	je     80146c <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801445:	6a 07                	push   $0x7
  801447:	68 00 50 80 00       	push   $0x805000
  80144c:	56                   	push   %esi
  80144d:	ff 35 00 40 80 00    	pushl  0x804000
  801453:	e8 1c 08 00 00       	call   801c74 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801458:	83 c4 0c             	add    $0xc,%esp
  80145b:	6a 00                	push   $0x0
  80145d:	53                   	push   %ebx
  80145e:	6a 00                	push   $0x0
  801460:	e8 8e 07 00 00       	call   801bf3 <ipc_recv>
}
  801465:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801468:	5b                   	pop    %ebx
  801469:	5e                   	pop    %esi
  80146a:	5d                   	pop    %ebp
  80146b:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80146c:	83 ec 0c             	sub    $0xc,%esp
  80146f:	6a 01                	push   $0x1
  801471:	e8 56 08 00 00       	call   801ccc <ipc_find_env>
  801476:	a3 00 40 80 00       	mov    %eax,0x804000
  80147b:	83 c4 10             	add    $0x10,%esp
  80147e:	eb c5                	jmp    801445 <fsipc+0x12>

00801480 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801480:	f3 0f 1e fb          	endbr32 
  801484:	55                   	push   %ebp
  801485:	89 e5                	mov    %esp,%ebp
  801487:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  80148a:	8b 45 08             	mov    0x8(%ebp),%eax
  80148d:	8b 40 0c             	mov    0xc(%eax),%eax
  801490:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801495:	8b 45 0c             	mov    0xc(%ebp),%eax
  801498:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80149d:	ba 00 00 00 00       	mov    $0x0,%edx
  8014a2:	b8 02 00 00 00       	mov    $0x2,%eax
  8014a7:	e8 87 ff ff ff       	call   801433 <fsipc>
}
  8014ac:	c9                   	leave  
  8014ad:	c3                   	ret    

008014ae <devfile_flush>:
{
  8014ae:	f3 0f 1e fb          	endbr32 
  8014b2:	55                   	push   %ebp
  8014b3:	89 e5                	mov    %esp,%ebp
  8014b5:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8014b8:	8b 45 08             	mov    0x8(%ebp),%eax
  8014bb:	8b 40 0c             	mov    0xc(%eax),%eax
  8014be:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8014c3:	ba 00 00 00 00       	mov    $0x0,%edx
  8014c8:	b8 06 00 00 00       	mov    $0x6,%eax
  8014cd:	e8 61 ff ff ff       	call   801433 <fsipc>
}
  8014d2:	c9                   	leave  
  8014d3:	c3                   	ret    

008014d4 <devfile_stat>:
{
  8014d4:	f3 0f 1e fb          	endbr32 
  8014d8:	55                   	push   %ebp
  8014d9:	89 e5                	mov    %esp,%ebp
  8014db:	53                   	push   %ebx
  8014dc:	83 ec 04             	sub    $0x4,%esp
  8014df:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8014e2:	8b 45 08             	mov    0x8(%ebp),%eax
  8014e5:	8b 40 0c             	mov    0xc(%eax),%eax
  8014e8:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8014ed:	ba 00 00 00 00       	mov    $0x0,%edx
  8014f2:	b8 05 00 00 00       	mov    $0x5,%eax
  8014f7:	e8 37 ff ff ff       	call   801433 <fsipc>
  8014fc:	85 c0                	test   %eax,%eax
  8014fe:	78 2c                	js     80152c <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801500:	83 ec 08             	sub    $0x8,%esp
  801503:	68 00 50 80 00       	push   $0x805000
  801508:	53                   	push   %ebx
  801509:	e8 62 f2 ff ff       	call   800770 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  80150e:	a1 80 50 80 00       	mov    0x805080,%eax
  801513:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801519:	a1 84 50 80 00       	mov    0x805084,%eax
  80151e:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801524:	83 c4 10             	add    $0x10,%esp
  801527:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80152c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80152f:	c9                   	leave  
  801530:	c3                   	ret    

00801531 <devfile_write>:
{
  801531:	f3 0f 1e fb          	endbr32 
  801535:	55                   	push   %ebp
  801536:	89 e5                	mov    %esp,%ebp
  801538:	83 ec 0c             	sub    $0xc,%esp
  80153b:	8b 45 10             	mov    0x10(%ebp),%eax
  80153e:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801543:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801548:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80154b:	8b 55 08             	mov    0x8(%ebp),%edx
  80154e:	8b 52 0c             	mov    0xc(%edx),%edx
  801551:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801557:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  80155c:	50                   	push   %eax
  80155d:	ff 75 0c             	pushl  0xc(%ebp)
  801560:	68 08 50 80 00       	push   $0x805008
  801565:	e8 bc f3 ff ff       	call   800926 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80156a:	ba 00 00 00 00       	mov    $0x0,%edx
  80156f:	b8 04 00 00 00       	mov    $0x4,%eax
  801574:	e8 ba fe ff ff       	call   801433 <fsipc>
  801579:	c9                   	leave  
  80157a:	c3                   	ret    

0080157b <devfile_read>:
{
  80157b:	f3 0f 1e fb          	endbr32 
  80157f:	55                   	push   %ebp
  801580:	89 e5                	mov    %esp,%ebp
  801582:	56                   	push   %esi
  801583:	53                   	push   %ebx
  801584:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801587:	8b 45 08             	mov    0x8(%ebp),%eax
  80158a:	8b 40 0c             	mov    0xc(%eax),%eax
  80158d:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801592:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801598:	ba 00 00 00 00       	mov    $0x0,%edx
  80159d:	b8 03 00 00 00       	mov    $0x3,%eax
  8015a2:	e8 8c fe ff ff       	call   801433 <fsipc>
  8015a7:	89 c3                	mov    %eax,%ebx
  8015a9:	85 c0                	test   %eax,%eax
  8015ab:	78 1f                	js     8015cc <devfile_read+0x51>
	assert(r <= n);
  8015ad:	39 f0                	cmp    %esi,%eax
  8015af:	77 24                	ja     8015d5 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8015b1:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8015b6:	7f 33                	jg     8015eb <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8015b8:	83 ec 04             	sub    $0x4,%esp
  8015bb:	50                   	push   %eax
  8015bc:	68 00 50 80 00       	push   $0x805000
  8015c1:	ff 75 0c             	pushl  0xc(%ebp)
  8015c4:	e8 5d f3 ff ff       	call   800926 <memmove>
	return r;
  8015c9:	83 c4 10             	add    $0x10,%esp
}
  8015cc:	89 d8                	mov    %ebx,%eax
  8015ce:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8015d1:	5b                   	pop    %ebx
  8015d2:	5e                   	pop    %esi
  8015d3:	5d                   	pop    %ebp
  8015d4:	c3                   	ret    
	assert(r <= n);
  8015d5:	68 08 24 80 00       	push   $0x802408
  8015da:	68 0f 24 80 00       	push   $0x80240f
  8015df:	6a 7c                	push   $0x7c
  8015e1:	68 24 24 80 00       	push   $0x802424
  8015e6:	e8 be 05 00 00       	call   801ba9 <_panic>
	assert(r <= PGSIZE);
  8015eb:	68 2f 24 80 00       	push   $0x80242f
  8015f0:	68 0f 24 80 00       	push   $0x80240f
  8015f5:	6a 7d                	push   $0x7d
  8015f7:	68 24 24 80 00       	push   $0x802424
  8015fc:	e8 a8 05 00 00       	call   801ba9 <_panic>

00801601 <open>:
{
  801601:	f3 0f 1e fb          	endbr32 
  801605:	55                   	push   %ebp
  801606:	89 e5                	mov    %esp,%ebp
  801608:	56                   	push   %esi
  801609:	53                   	push   %ebx
  80160a:	83 ec 1c             	sub    $0x1c,%esp
  80160d:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801610:	56                   	push   %esi
  801611:	e8 17 f1 ff ff       	call   80072d <strlen>
  801616:	83 c4 10             	add    $0x10,%esp
  801619:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  80161e:	7f 6c                	jg     80168c <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801620:	83 ec 0c             	sub    $0xc,%esp
  801623:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801626:	50                   	push   %eax
  801627:	e8 67 f8 ff ff       	call   800e93 <fd_alloc>
  80162c:	89 c3                	mov    %eax,%ebx
  80162e:	83 c4 10             	add    $0x10,%esp
  801631:	85 c0                	test   %eax,%eax
  801633:	78 3c                	js     801671 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801635:	83 ec 08             	sub    $0x8,%esp
  801638:	56                   	push   %esi
  801639:	68 00 50 80 00       	push   $0x805000
  80163e:	e8 2d f1 ff ff       	call   800770 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801643:	8b 45 0c             	mov    0xc(%ebp),%eax
  801646:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  80164b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80164e:	b8 01 00 00 00       	mov    $0x1,%eax
  801653:	e8 db fd ff ff       	call   801433 <fsipc>
  801658:	89 c3                	mov    %eax,%ebx
  80165a:	83 c4 10             	add    $0x10,%esp
  80165d:	85 c0                	test   %eax,%eax
  80165f:	78 19                	js     80167a <open+0x79>
	return fd2num(fd);
  801661:	83 ec 0c             	sub    $0xc,%esp
  801664:	ff 75 f4             	pushl  -0xc(%ebp)
  801667:	e8 f8 f7 ff ff       	call   800e64 <fd2num>
  80166c:	89 c3                	mov    %eax,%ebx
  80166e:	83 c4 10             	add    $0x10,%esp
}
  801671:	89 d8                	mov    %ebx,%eax
  801673:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801676:	5b                   	pop    %ebx
  801677:	5e                   	pop    %esi
  801678:	5d                   	pop    %ebp
  801679:	c3                   	ret    
		fd_close(fd, 0);
  80167a:	83 ec 08             	sub    $0x8,%esp
  80167d:	6a 00                	push   $0x0
  80167f:	ff 75 f4             	pushl  -0xc(%ebp)
  801682:	e8 10 f9 ff ff       	call   800f97 <fd_close>
		return r;
  801687:	83 c4 10             	add    $0x10,%esp
  80168a:	eb e5                	jmp    801671 <open+0x70>
		return -E_BAD_PATH;
  80168c:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801691:	eb de                	jmp    801671 <open+0x70>

00801693 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801693:	f3 0f 1e fb          	endbr32 
  801697:	55                   	push   %ebp
  801698:	89 e5                	mov    %esp,%ebp
  80169a:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  80169d:	ba 00 00 00 00       	mov    $0x0,%edx
  8016a2:	b8 08 00 00 00       	mov    $0x8,%eax
  8016a7:	e8 87 fd ff ff       	call   801433 <fsipc>
}
  8016ac:	c9                   	leave  
  8016ad:	c3                   	ret    

008016ae <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  8016ae:	f3 0f 1e fb          	endbr32 
  8016b2:	55                   	push   %ebp
  8016b3:	89 e5                	mov    %esp,%ebp
  8016b5:	56                   	push   %esi
  8016b6:	53                   	push   %ebx
  8016b7:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  8016ba:	83 ec 0c             	sub    $0xc,%esp
  8016bd:	ff 75 08             	pushl  0x8(%ebp)
  8016c0:	e8 b3 f7 ff ff       	call   800e78 <fd2data>
  8016c5:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  8016c7:	83 c4 08             	add    $0x8,%esp
  8016ca:	68 3b 24 80 00       	push   $0x80243b
  8016cf:	53                   	push   %ebx
  8016d0:	e8 9b f0 ff ff       	call   800770 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  8016d5:	8b 46 04             	mov    0x4(%esi),%eax
  8016d8:	2b 06                	sub    (%esi),%eax
  8016da:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  8016e0:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8016e7:	00 00 00 
	stat->st_dev = &devpipe;
  8016ea:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  8016f1:	30 80 00 
	return 0;
}
  8016f4:	b8 00 00 00 00       	mov    $0x0,%eax
  8016f9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8016fc:	5b                   	pop    %ebx
  8016fd:	5e                   	pop    %esi
  8016fe:	5d                   	pop    %ebp
  8016ff:	c3                   	ret    

00801700 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801700:	f3 0f 1e fb          	endbr32 
  801704:	55                   	push   %ebp
  801705:	89 e5                	mov    %esp,%ebp
  801707:	53                   	push   %ebx
  801708:	83 ec 0c             	sub    $0xc,%esp
  80170b:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  80170e:	53                   	push   %ebx
  80170f:	6a 00                	push   $0x0
  801711:	e8 29 f5 ff ff       	call   800c3f <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801716:	89 1c 24             	mov    %ebx,(%esp)
  801719:	e8 5a f7 ff ff       	call   800e78 <fd2data>
  80171e:	83 c4 08             	add    $0x8,%esp
  801721:	50                   	push   %eax
  801722:	6a 00                	push   $0x0
  801724:	e8 16 f5 ff ff       	call   800c3f <sys_page_unmap>
}
  801729:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80172c:	c9                   	leave  
  80172d:	c3                   	ret    

0080172e <_pipeisclosed>:
{
  80172e:	55                   	push   %ebp
  80172f:	89 e5                	mov    %esp,%ebp
  801731:	57                   	push   %edi
  801732:	56                   	push   %esi
  801733:	53                   	push   %ebx
  801734:	83 ec 1c             	sub    $0x1c,%esp
  801737:	89 c7                	mov    %eax,%edi
  801739:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  80173b:	a1 04 40 80 00       	mov    0x804004,%eax
  801740:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801743:	83 ec 0c             	sub    $0xc,%esp
  801746:	57                   	push   %edi
  801747:	e8 bd 05 00 00       	call   801d09 <pageref>
  80174c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80174f:	89 34 24             	mov    %esi,(%esp)
  801752:	e8 b2 05 00 00       	call   801d09 <pageref>
		nn = thisenv->env_runs;
  801757:	8b 15 04 40 80 00    	mov    0x804004,%edx
  80175d:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801760:	83 c4 10             	add    $0x10,%esp
  801763:	39 cb                	cmp    %ecx,%ebx
  801765:	74 1b                	je     801782 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801767:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  80176a:	75 cf                	jne    80173b <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  80176c:	8b 42 58             	mov    0x58(%edx),%eax
  80176f:	6a 01                	push   $0x1
  801771:	50                   	push   %eax
  801772:	53                   	push   %ebx
  801773:	68 42 24 80 00       	push   $0x802442
  801778:	e8 1a ea ff ff       	call   800197 <cprintf>
  80177d:	83 c4 10             	add    $0x10,%esp
  801780:	eb b9                	jmp    80173b <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801782:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801785:	0f 94 c0             	sete   %al
  801788:	0f b6 c0             	movzbl %al,%eax
}
  80178b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80178e:	5b                   	pop    %ebx
  80178f:	5e                   	pop    %esi
  801790:	5f                   	pop    %edi
  801791:	5d                   	pop    %ebp
  801792:	c3                   	ret    

00801793 <devpipe_write>:
{
  801793:	f3 0f 1e fb          	endbr32 
  801797:	55                   	push   %ebp
  801798:	89 e5                	mov    %esp,%ebp
  80179a:	57                   	push   %edi
  80179b:	56                   	push   %esi
  80179c:	53                   	push   %ebx
  80179d:	83 ec 28             	sub    $0x28,%esp
  8017a0:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  8017a3:	56                   	push   %esi
  8017a4:	e8 cf f6 ff ff       	call   800e78 <fd2data>
  8017a9:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  8017ab:	83 c4 10             	add    $0x10,%esp
  8017ae:	bf 00 00 00 00       	mov    $0x0,%edi
  8017b3:	3b 7d 10             	cmp    0x10(%ebp),%edi
  8017b6:	74 4f                	je     801807 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  8017b8:	8b 43 04             	mov    0x4(%ebx),%eax
  8017bb:	8b 0b                	mov    (%ebx),%ecx
  8017bd:	8d 51 20             	lea    0x20(%ecx),%edx
  8017c0:	39 d0                	cmp    %edx,%eax
  8017c2:	72 14                	jb     8017d8 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  8017c4:	89 da                	mov    %ebx,%edx
  8017c6:	89 f0                	mov    %esi,%eax
  8017c8:	e8 61 ff ff ff       	call   80172e <_pipeisclosed>
  8017cd:	85 c0                	test   %eax,%eax
  8017cf:	75 3b                	jne    80180c <devpipe_write+0x79>
			sys_yield();
  8017d1:	e8 b9 f3 ff ff       	call   800b8f <sys_yield>
  8017d6:	eb e0                	jmp    8017b8 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  8017d8:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8017db:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  8017df:	88 4d e7             	mov    %cl,-0x19(%ebp)
  8017e2:	89 c2                	mov    %eax,%edx
  8017e4:	c1 fa 1f             	sar    $0x1f,%edx
  8017e7:	89 d1                	mov    %edx,%ecx
  8017e9:	c1 e9 1b             	shr    $0x1b,%ecx
  8017ec:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  8017ef:	83 e2 1f             	and    $0x1f,%edx
  8017f2:	29 ca                	sub    %ecx,%edx
  8017f4:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  8017f8:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  8017fc:	83 c0 01             	add    $0x1,%eax
  8017ff:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801802:	83 c7 01             	add    $0x1,%edi
  801805:	eb ac                	jmp    8017b3 <devpipe_write+0x20>
	return i;
  801807:	8b 45 10             	mov    0x10(%ebp),%eax
  80180a:	eb 05                	jmp    801811 <devpipe_write+0x7e>
				return 0;
  80180c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801811:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801814:	5b                   	pop    %ebx
  801815:	5e                   	pop    %esi
  801816:	5f                   	pop    %edi
  801817:	5d                   	pop    %ebp
  801818:	c3                   	ret    

00801819 <devpipe_read>:
{
  801819:	f3 0f 1e fb          	endbr32 
  80181d:	55                   	push   %ebp
  80181e:	89 e5                	mov    %esp,%ebp
  801820:	57                   	push   %edi
  801821:	56                   	push   %esi
  801822:	53                   	push   %ebx
  801823:	83 ec 18             	sub    $0x18,%esp
  801826:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801829:	57                   	push   %edi
  80182a:	e8 49 f6 ff ff       	call   800e78 <fd2data>
  80182f:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801831:	83 c4 10             	add    $0x10,%esp
  801834:	be 00 00 00 00       	mov    $0x0,%esi
  801839:	3b 75 10             	cmp    0x10(%ebp),%esi
  80183c:	75 14                	jne    801852 <devpipe_read+0x39>
	return i;
  80183e:	8b 45 10             	mov    0x10(%ebp),%eax
  801841:	eb 02                	jmp    801845 <devpipe_read+0x2c>
				return i;
  801843:	89 f0                	mov    %esi,%eax
}
  801845:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801848:	5b                   	pop    %ebx
  801849:	5e                   	pop    %esi
  80184a:	5f                   	pop    %edi
  80184b:	5d                   	pop    %ebp
  80184c:	c3                   	ret    
			sys_yield();
  80184d:	e8 3d f3 ff ff       	call   800b8f <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801852:	8b 03                	mov    (%ebx),%eax
  801854:	3b 43 04             	cmp    0x4(%ebx),%eax
  801857:	75 18                	jne    801871 <devpipe_read+0x58>
			if (i > 0)
  801859:	85 f6                	test   %esi,%esi
  80185b:	75 e6                	jne    801843 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  80185d:	89 da                	mov    %ebx,%edx
  80185f:	89 f8                	mov    %edi,%eax
  801861:	e8 c8 fe ff ff       	call   80172e <_pipeisclosed>
  801866:	85 c0                	test   %eax,%eax
  801868:	74 e3                	je     80184d <devpipe_read+0x34>
				return 0;
  80186a:	b8 00 00 00 00       	mov    $0x0,%eax
  80186f:	eb d4                	jmp    801845 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801871:	99                   	cltd   
  801872:	c1 ea 1b             	shr    $0x1b,%edx
  801875:	01 d0                	add    %edx,%eax
  801877:	83 e0 1f             	and    $0x1f,%eax
  80187a:	29 d0                	sub    %edx,%eax
  80187c:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801881:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801884:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801887:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  80188a:	83 c6 01             	add    $0x1,%esi
  80188d:	eb aa                	jmp    801839 <devpipe_read+0x20>

0080188f <pipe>:
{
  80188f:	f3 0f 1e fb          	endbr32 
  801893:	55                   	push   %ebp
  801894:	89 e5                	mov    %esp,%ebp
  801896:	56                   	push   %esi
  801897:	53                   	push   %ebx
  801898:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  80189b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80189e:	50                   	push   %eax
  80189f:	e8 ef f5 ff ff       	call   800e93 <fd_alloc>
  8018a4:	89 c3                	mov    %eax,%ebx
  8018a6:	83 c4 10             	add    $0x10,%esp
  8018a9:	85 c0                	test   %eax,%eax
  8018ab:	0f 88 23 01 00 00    	js     8019d4 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8018b1:	83 ec 04             	sub    $0x4,%esp
  8018b4:	68 07 04 00 00       	push   $0x407
  8018b9:	ff 75 f4             	pushl  -0xc(%ebp)
  8018bc:	6a 00                	push   $0x0
  8018be:	e8 ef f2 ff ff       	call   800bb2 <sys_page_alloc>
  8018c3:	89 c3                	mov    %eax,%ebx
  8018c5:	83 c4 10             	add    $0x10,%esp
  8018c8:	85 c0                	test   %eax,%eax
  8018ca:	0f 88 04 01 00 00    	js     8019d4 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  8018d0:	83 ec 0c             	sub    $0xc,%esp
  8018d3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8018d6:	50                   	push   %eax
  8018d7:	e8 b7 f5 ff ff       	call   800e93 <fd_alloc>
  8018dc:	89 c3                	mov    %eax,%ebx
  8018de:	83 c4 10             	add    $0x10,%esp
  8018e1:	85 c0                	test   %eax,%eax
  8018e3:	0f 88 db 00 00 00    	js     8019c4 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8018e9:	83 ec 04             	sub    $0x4,%esp
  8018ec:	68 07 04 00 00       	push   $0x407
  8018f1:	ff 75 f0             	pushl  -0x10(%ebp)
  8018f4:	6a 00                	push   $0x0
  8018f6:	e8 b7 f2 ff ff       	call   800bb2 <sys_page_alloc>
  8018fb:	89 c3                	mov    %eax,%ebx
  8018fd:	83 c4 10             	add    $0x10,%esp
  801900:	85 c0                	test   %eax,%eax
  801902:	0f 88 bc 00 00 00    	js     8019c4 <pipe+0x135>
	va = fd2data(fd0);
  801908:	83 ec 0c             	sub    $0xc,%esp
  80190b:	ff 75 f4             	pushl  -0xc(%ebp)
  80190e:	e8 65 f5 ff ff       	call   800e78 <fd2data>
  801913:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801915:	83 c4 0c             	add    $0xc,%esp
  801918:	68 07 04 00 00       	push   $0x407
  80191d:	50                   	push   %eax
  80191e:	6a 00                	push   $0x0
  801920:	e8 8d f2 ff ff       	call   800bb2 <sys_page_alloc>
  801925:	89 c3                	mov    %eax,%ebx
  801927:	83 c4 10             	add    $0x10,%esp
  80192a:	85 c0                	test   %eax,%eax
  80192c:	0f 88 82 00 00 00    	js     8019b4 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801932:	83 ec 0c             	sub    $0xc,%esp
  801935:	ff 75 f0             	pushl  -0x10(%ebp)
  801938:	e8 3b f5 ff ff       	call   800e78 <fd2data>
  80193d:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801944:	50                   	push   %eax
  801945:	6a 00                	push   $0x0
  801947:	56                   	push   %esi
  801948:	6a 00                	push   $0x0
  80194a:	e8 aa f2 ff ff       	call   800bf9 <sys_page_map>
  80194f:	89 c3                	mov    %eax,%ebx
  801951:	83 c4 20             	add    $0x20,%esp
  801954:	85 c0                	test   %eax,%eax
  801956:	78 4e                	js     8019a6 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801958:	a1 20 30 80 00       	mov    0x803020,%eax
  80195d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801960:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801962:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801965:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  80196c:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80196f:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801971:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801974:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  80197b:	83 ec 0c             	sub    $0xc,%esp
  80197e:	ff 75 f4             	pushl  -0xc(%ebp)
  801981:	e8 de f4 ff ff       	call   800e64 <fd2num>
  801986:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801989:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  80198b:	83 c4 04             	add    $0x4,%esp
  80198e:	ff 75 f0             	pushl  -0x10(%ebp)
  801991:	e8 ce f4 ff ff       	call   800e64 <fd2num>
  801996:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801999:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  80199c:	83 c4 10             	add    $0x10,%esp
  80199f:	bb 00 00 00 00       	mov    $0x0,%ebx
  8019a4:	eb 2e                	jmp    8019d4 <pipe+0x145>
	sys_page_unmap(0, va);
  8019a6:	83 ec 08             	sub    $0x8,%esp
  8019a9:	56                   	push   %esi
  8019aa:	6a 00                	push   $0x0
  8019ac:	e8 8e f2 ff ff       	call   800c3f <sys_page_unmap>
  8019b1:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  8019b4:	83 ec 08             	sub    $0x8,%esp
  8019b7:	ff 75 f0             	pushl  -0x10(%ebp)
  8019ba:	6a 00                	push   $0x0
  8019bc:	e8 7e f2 ff ff       	call   800c3f <sys_page_unmap>
  8019c1:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  8019c4:	83 ec 08             	sub    $0x8,%esp
  8019c7:	ff 75 f4             	pushl  -0xc(%ebp)
  8019ca:	6a 00                	push   $0x0
  8019cc:	e8 6e f2 ff ff       	call   800c3f <sys_page_unmap>
  8019d1:	83 c4 10             	add    $0x10,%esp
}
  8019d4:	89 d8                	mov    %ebx,%eax
  8019d6:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019d9:	5b                   	pop    %ebx
  8019da:	5e                   	pop    %esi
  8019db:	5d                   	pop    %ebp
  8019dc:	c3                   	ret    

008019dd <pipeisclosed>:
{
  8019dd:	f3 0f 1e fb          	endbr32 
  8019e1:	55                   	push   %ebp
  8019e2:	89 e5                	mov    %esp,%ebp
  8019e4:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8019e7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8019ea:	50                   	push   %eax
  8019eb:	ff 75 08             	pushl  0x8(%ebp)
  8019ee:	e8 f6 f4 ff ff       	call   800ee9 <fd_lookup>
  8019f3:	83 c4 10             	add    $0x10,%esp
  8019f6:	85 c0                	test   %eax,%eax
  8019f8:	78 18                	js     801a12 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  8019fa:	83 ec 0c             	sub    $0xc,%esp
  8019fd:	ff 75 f4             	pushl  -0xc(%ebp)
  801a00:	e8 73 f4 ff ff       	call   800e78 <fd2data>
  801a05:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801a07:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a0a:	e8 1f fd ff ff       	call   80172e <_pipeisclosed>
  801a0f:	83 c4 10             	add    $0x10,%esp
}
  801a12:	c9                   	leave  
  801a13:	c3                   	ret    

00801a14 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801a14:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801a18:	b8 00 00 00 00       	mov    $0x0,%eax
  801a1d:	c3                   	ret    

00801a1e <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801a1e:	f3 0f 1e fb          	endbr32 
  801a22:	55                   	push   %ebp
  801a23:	89 e5                	mov    %esp,%ebp
  801a25:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801a28:	68 5a 24 80 00       	push   $0x80245a
  801a2d:	ff 75 0c             	pushl  0xc(%ebp)
  801a30:	e8 3b ed ff ff       	call   800770 <strcpy>
	return 0;
}
  801a35:	b8 00 00 00 00       	mov    $0x0,%eax
  801a3a:	c9                   	leave  
  801a3b:	c3                   	ret    

00801a3c <devcons_write>:
{
  801a3c:	f3 0f 1e fb          	endbr32 
  801a40:	55                   	push   %ebp
  801a41:	89 e5                	mov    %esp,%ebp
  801a43:	57                   	push   %edi
  801a44:	56                   	push   %esi
  801a45:	53                   	push   %ebx
  801a46:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801a4c:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801a51:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801a57:	3b 75 10             	cmp    0x10(%ebp),%esi
  801a5a:	73 31                	jae    801a8d <devcons_write+0x51>
		m = n - tot;
  801a5c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801a5f:	29 f3                	sub    %esi,%ebx
  801a61:	83 fb 7f             	cmp    $0x7f,%ebx
  801a64:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801a69:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801a6c:	83 ec 04             	sub    $0x4,%esp
  801a6f:	53                   	push   %ebx
  801a70:	89 f0                	mov    %esi,%eax
  801a72:	03 45 0c             	add    0xc(%ebp),%eax
  801a75:	50                   	push   %eax
  801a76:	57                   	push   %edi
  801a77:	e8 aa ee ff ff       	call   800926 <memmove>
		sys_cputs(buf, m);
  801a7c:	83 c4 08             	add    $0x8,%esp
  801a7f:	53                   	push   %ebx
  801a80:	57                   	push   %edi
  801a81:	e8 5c f0 ff ff       	call   800ae2 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801a86:	01 de                	add    %ebx,%esi
  801a88:	83 c4 10             	add    $0x10,%esp
  801a8b:	eb ca                	jmp    801a57 <devcons_write+0x1b>
}
  801a8d:	89 f0                	mov    %esi,%eax
  801a8f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a92:	5b                   	pop    %ebx
  801a93:	5e                   	pop    %esi
  801a94:	5f                   	pop    %edi
  801a95:	5d                   	pop    %ebp
  801a96:	c3                   	ret    

00801a97 <devcons_read>:
{
  801a97:	f3 0f 1e fb          	endbr32 
  801a9b:	55                   	push   %ebp
  801a9c:	89 e5                	mov    %esp,%ebp
  801a9e:	83 ec 08             	sub    $0x8,%esp
  801aa1:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801aa6:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801aaa:	74 21                	je     801acd <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801aac:	e8 53 f0 ff ff       	call   800b04 <sys_cgetc>
  801ab1:	85 c0                	test   %eax,%eax
  801ab3:	75 07                	jne    801abc <devcons_read+0x25>
		sys_yield();
  801ab5:	e8 d5 f0 ff ff       	call   800b8f <sys_yield>
  801aba:	eb f0                	jmp    801aac <devcons_read+0x15>
	if (c < 0)
  801abc:	78 0f                	js     801acd <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801abe:	83 f8 04             	cmp    $0x4,%eax
  801ac1:	74 0c                	je     801acf <devcons_read+0x38>
	*(char*)vbuf = c;
  801ac3:	8b 55 0c             	mov    0xc(%ebp),%edx
  801ac6:	88 02                	mov    %al,(%edx)
	return 1;
  801ac8:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801acd:	c9                   	leave  
  801ace:	c3                   	ret    
		return 0;
  801acf:	b8 00 00 00 00       	mov    $0x0,%eax
  801ad4:	eb f7                	jmp    801acd <devcons_read+0x36>

00801ad6 <cputchar>:
{
  801ad6:	f3 0f 1e fb          	endbr32 
  801ada:	55                   	push   %ebp
  801adb:	89 e5                	mov    %esp,%ebp
  801add:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801ae0:	8b 45 08             	mov    0x8(%ebp),%eax
  801ae3:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801ae6:	6a 01                	push   $0x1
  801ae8:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801aeb:	50                   	push   %eax
  801aec:	e8 f1 ef ff ff       	call   800ae2 <sys_cputs>
}
  801af1:	83 c4 10             	add    $0x10,%esp
  801af4:	c9                   	leave  
  801af5:	c3                   	ret    

00801af6 <getchar>:
{
  801af6:	f3 0f 1e fb          	endbr32 
  801afa:	55                   	push   %ebp
  801afb:	89 e5                	mov    %esp,%ebp
  801afd:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801b00:	6a 01                	push   $0x1
  801b02:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801b05:	50                   	push   %eax
  801b06:	6a 00                	push   $0x0
  801b08:	e8 5f f6 ff ff       	call   80116c <read>
	if (r < 0)
  801b0d:	83 c4 10             	add    $0x10,%esp
  801b10:	85 c0                	test   %eax,%eax
  801b12:	78 06                	js     801b1a <getchar+0x24>
	if (r < 1)
  801b14:	74 06                	je     801b1c <getchar+0x26>
	return c;
  801b16:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801b1a:	c9                   	leave  
  801b1b:	c3                   	ret    
		return -E_EOF;
  801b1c:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801b21:	eb f7                	jmp    801b1a <getchar+0x24>

00801b23 <iscons>:
{
  801b23:	f3 0f 1e fb          	endbr32 
  801b27:	55                   	push   %ebp
  801b28:	89 e5                	mov    %esp,%ebp
  801b2a:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801b2d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801b30:	50                   	push   %eax
  801b31:	ff 75 08             	pushl  0x8(%ebp)
  801b34:	e8 b0 f3 ff ff       	call   800ee9 <fd_lookup>
  801b39:	83 c4 10             	add    $0x10,%esp
  801b3c:	85 c0                	test   %eax,%eax
  801b3e:	78 11                	js     801b51 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801b40:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801b43:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801b49:	39 10                	cmp    %edx,(%eax)
  801b4b:	0f 94 c0             	sete   %al
  801b4e:	0f b6 c0             	movzbl %al,%eax
}
  801b51:	c9                   	leave  
  801b52:	c3                   	ret    

00801b53 <opencons>:
{
  801b53:	f3 0f 1e fb          	endbr32 
  801b57:	55                   	push   %ebp
  801b58:	89 e5                	mov    %esp,%ebp
  801b5a:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801b5d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801b60:	50                   	push   %eax
  801b61:	e8 2d f3 ff ff       	call   800e93 <fd_alloc>
  801b66:	83 c4 10             	add    $0x10,%esp
  801b69:	85 c0                	test   %eax,%eax
  801b6b:	78 3a                	js     801ba7 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801b6d:	83 ec 04             	sub    $0x4,%esp
  801b70:	68 07 04 00 00       	push   $0x407
  801b75:	ff 75 f4             	pushl  -0xc(%ebp)
  801b78:	6a 00                	push   $0x0
  801b7a:	e8 33 f0 ff ff       	call   800bb2 <sys_page_alloc>
  801b7f:	83 c4 10             	add    $0x10,%esp
  801b82:	85 c0                	test   %eax,%eax
  801b84:	78 21                	js     801ba7 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801b86:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801b89:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801b8f:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801b91:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801b94:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801b9b:	83 ec 0c             	sub    $0xc,%esp
  801b9e:	50                   	push   %eax
  801b9f:	e8 c0 f2 ff ff       	call   800e64 <fd2num>
  801ba4:	83 c4 10             	add    $0x10,%esp
}
  801ba7:	c9                   	leave  
  801ba8:	c3                   	ret    

00801ba9 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801ba9:	f3 0f 1e fb          	endbr32 
  801bad:	55                   	push   %ebp
  801bae:	89 e5                	mov    %esp,%ebp
  801bb0:	56                   	push   %esi
  801bb1:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801bb2:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801bb5:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801bbb:	e8 ac ef ff ff       	call   800b6c <sys_getenvid>
  801bc0:	83 ec 0c             	sub    $0xc,%esp
  801bc3:	ff 75 0c             	pushl  0xc(%ebp)
  801bc6:	ff 75 08             	pushl  0x8(%ebp)
  801bc9:	56                   	push   %esi
  801bca:	50                   	push   %eax
  801bcb:	68 68 24 80 00       	push   $0x802468
  801bd0:	e8 c2 e5 ff ff       	call   800197 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801bd5:	83 c4 18             	add    $0x18,%esp
  801bd8:	53                   	push   %ebx
  801bd9:	ff 75 10             	pushl  0x10(%ebp)
  801bdc:	e8 61 e5 ff ff       	call   800142 <vcprintf>
	cprintf("\n");
  801be1:	c7 04 24 53 24 80 00 	movl   $0x802453,(%esp)
  801be8:	e8 aa e5 ff ff       	call   800197 <cprintf>
  801bed:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801bf0:	cc                   	int3   
  801bf1:	eb fd                	jmp    801bf0 <_panic+0x47>

00801bf3 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801bf3:	f3 0f 1e fb          	endbr32 
  801bf7:	55                   	push   %ebp
  801bf8:	89 e5                	mov    %esp,%ebp
  801bfa:	56                   	push   %esi
  801bfb:	53                   	push   %ebx
  801bfc:	8b 75 08             	mov    0x8(%ebp),%esi
  801bff:	8b 45 0c             	mov    0xc(%ebp),%eax
  801c02:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801c05:	85 c0                	test   %eax,%eax
  801c07:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801c0c:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801c0f:	83 ec 0c             	sub    $0xc,%esp
  801c12:	50                   	push   %eax
  801c13:	e8 66 f1 ff ff       	call   800d7e <sys_ipc_recv>
  801c18:	83 c4 10             	add    $0x10,%esp
  801c1b:	85 c0                	test   %eax,%eax
  801c1d:	78 3f                	js     801c5e <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801c1f:	e8 48 ef ff ff       	call   800b6c <sys_getenvid>
  801c24:	25 ff 03 00 00       	and    $0x3ff,%eax
  801c29:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801c2c:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801c32:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801c38:	85 f6                	test   %esi,%esi
  801c3a:	74 05                	je     801c41 <ipc_recv+0x4e>
  801c3c:	8b 42 74             	mov    0x74(%edx),%eax
  801c3f:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801c41:	85 db                	test   %ebx,%ebx
  801c43:	74 0a                	je     801c4f <ipc_recv+0x5c>
  801c45:	a1 04 40 80 00       	mov    0x804004,%eax
  801c4a:	8b 40 78             	mov    0x78(%eax),%eax
  801c4d:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801c4f:	a1 04 40 80 00       	mov    0x804004,%eax
  801c54:	8b 40 70             	mov    0x70(%eax),%eax
}
  801c57:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801c5a:	5b                   	pop    %ebx
  801c5b:	5e                   	pop    %esi
  801c5c:	5d                   	pop    %ebp
  801c5d:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801c5e:	85 f6                	test   %esi,%esi
  801c60:	74 06                	je     801c68 <ipc_recv+0x75>
  801c62:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801c68:	85 db                	test   %ebx,%ebx
  801c6a:	74 eb                	je     801c57 <ipc_recv+0x64>
  801c6c:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801c72:	eb e3                	jmp    801c57 <ipc_recv+0x64>

00801c74 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801c74:	f3 0f 1e fb          	endbr32 
  801c78:	55                   	push   %ebp
  801c79:	89 e5                	mov    %esp,%ebp
  801c7b:	57                   	push   %edi
  801c7c:	56                   	push   %esi
  801c7d:	53                   	push   %ebx
  801c7e:	83 ec 0c             	sub    $0xc,%esp
  801c81:	8b 7d 08             	mov    0x8(%ebp),%edi
  801c84:	8b 75 0c             	mov    0xc(%ebp),%esi
  801c87:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801c8a:	85 db                	test   %ebx,%ebx
  801c8c:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801c91:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801c94:	ff 75 14             	pushl  0x14(%ebp)
  801c97:	53                   	push   %ebx
  801c98:	56                   	push   %esi
  801c99:	57                   	push   %edi
  801c9a:	e8 b8 f0 ff ff       	call   800d57 <sys_ipc_try_send>
  801c9f:	83 c4 10             	add    $0x10,%esp
  801ca2:	85 c0                	test   %eax,%eax
  801ca4:	79 1e                	jns    801cc4 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801ca6:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801ca9:	75 07                	jne    801cb2 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801cab:	e8 df ee ff ff       	call   800b8f <sys_yield>
  801cb0:	eb e2                	jmp    801c94 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801cb2:	50                   	push   %eax
  801cb3:	68 8b 24 80 00       	push   $0x80248b
  801cb8:	6a 3b                	push   $0x3b
  801cba:	68 9f 24 80 00       	push   $0x80249f
  801cbf:	e8 e5 fe ff ff       	call   801ba9 <_panic>
	}
}
  801cc4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801cc7:	5b                   	pop    %ebx
  801cc8:	5e                   	pop    %esi
  801cc9:	5f                   	pop    %edi
  801cca:	5d                   	pop    %ebp
  801ccb:	c3                   	ret    

00801ccc <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801ccc:	f3 0f 1e fb          	endbr32 
  801cd0:	55                   	push   %ebp
  801cd1:	89 e5                	mov    %esp,%ebp
  801cd3:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801cd6:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801cdb:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801cde:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801ce4:	8b 52 50             	mov    0x50(%edx),%edx
  801ce7:	39 ca                	cmp    %ecx,%edx
  801ce9:	74 11                	je     801cfc <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801ceb:	83 c0 01             	add    $0x1,%eax
  801cee:	3d 00 04 00 00       	cmp    $0x400,%eax
  801cf3:	75 e6                	jne    801cdb <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801cf5:	b8 00 00 00 00       	mov    $0x0,%eax
  801cfa:	eb 0b                	jmp    801d07 <ipc_find_env+0x3b>
			return envs[i].env_id;
  801cfc:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801cff:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801d04:	8b 40 48             	mov    0x48(%eax),%eax
}
  801d07:	5d                   	pop    %ebp
  801d08:	c3                   	ret    

00801d09 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801d09:	f3 0f 1e fb          	endbr32 
  801d0d:	55                   	push   %ebp
  801d0e:	89 e5                	mov    %esp,%ebp
  801d10:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801d13:	89 c2                	mov    %eax,%edx
  801d15:	c1 ea 16             	shr    $0x16,%edx
  801d18:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801d1f:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801d24:	f6 c1 01             	test   $0x1,%cl
  801d27:	74 1c                	je     801d45 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801d29:	c1 e8 0c             	shr    $0xc,%eax
  801d2c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801d33:	a8 01                	test   $0x1,%al
  801d35:	74 0e                	je     801d45 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801d37:	c1 e8 0c             	shr    $0xc,%eax
  801d3a:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801d41:	ef 
  801d42:	0f b7 d2             	movzwl %dx,%edx
}
  801d45:	89 d0                	mov    %edx,%eax
  801d47:	5d                   	pop    %ebp
  801d48:	c3                   	ret    
  801d49:	66 90                	xchg   %ax,%ax
  801d4b:	66 90                	xchg   %ax,%ax
  801d4d:	66 90                	xchg   %ax,%ax
  801d4f:	90                   	nop

00801d50 <__udivdi3>:
  801d50:	f3 0f 1e fb          	endbr32 
  801d54:	55                   	push   %ebp
  801d55:	57                   	push   %edi
  801d56:	56                   	push   %esi
  801d57:	53                   	push   %ebx
  801d58:	83 ec 1c             	sub    $0x1c,%esp
  801d5b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801d5f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801d63:	8b 74 24 34          	mov    0x34(%esp),%esi
  801d67:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801d6b:	85 d2                	test   %edx,%edx
  801d6d:	75 19                	jne    801d88 <__udivdi3+0x38>
  801d6f:	39 f3                	cmp    %esi,%ebx
  801d71:	76 4d                	jbe    801dc0 <__udivdi3+0x70>
  801d73:	31 ff                	xor    %edi,%edi
  801d75:	89 e8                	mov    %ebp,%eax
  801d77:	89 f2                	mov    %esi,%edx
  801d79:	f7 f3                	div    %ebx
  801d7b:	89 fa                	mov    %edi,%edx
  801d7d:	83 c4 1c             	add    $0x1c,%esp
  801d80:	5b                   	pop    %ebx
  801d81:	5e                   	pop    %esi
  801d82:	5f                   	pop    %edi
  801d83:	5d                   	pop    %ebp
  801d84:	c3                   	ret    
  801d85:	8d 76 00             	lea    0x0(%esi),%esi
  801d88:	39 f2                	cmp    %esi,%edx
  801d8a:	76 14                	jbe    801da0 <__udivdi3+0x50>
  801d8c:	31 ff                	xor    %edi,%edi
  801d8e:	31 c0                	xor    %eax,%eax
  801d90:	89 fa                	mov    %edi,%edx
  801d92:	83 c4 1c             	add    $0x1c,%esp
  801d95:	5b                   	pop    %ebx
  801d96:	5e                   	pop    %esi
  801d97:	5f                   	pop    %edi
  801d98:	5d                   	pop    %ebp
  801d99:	c3                   	ret    
  801d9a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801da0:	0f bd fa             	bsr    %edx,%edi
  801da3:	83 f7 1f             	xor    $0x1f,%edi
  801da6:	75 48                	jne    801df0 <__udivdi3+0xa0>
  801da8:	39 f2                	cmp    %esi,%edx
  801daa:	72 06                	jb     801db2 <__udivdi3+0x62>
  801dac:	31 c0                	xor    %eax,%eax
  801dae:	39 eb                	cmp    %ebp,%ebx
  801db0:	77 de                	ja     801d90 <__udivdi3+0x40>
  801db2:	b8 01 00 00 00       	mov    $0x1,%eax
  801db7:	eb d7                	jmp    801d90 <__udivdi3+0x40>
  801db9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801dc0:	89 d9                	mov    %ebx,%ecx
  801dc2:	85 db                	test   %ebx,%ebx
  801dc4:	75 0b                	jne    801dd1 <__udivdi3+0x81>
  801dc6:	b8 01 00 00 00       	mov    $0x1,%eax
  801dcb:	31 d2                	xor    %edx,%edx
  801dcd:	f7 f3                	div    %ebx
  801dcf:	89 c1                	mov    %eax,%ecx
  801dd1:	31 d2                	xor    %edx,%edx
  801dd3:	89 f0                	mov    %esi,%eax
  801dd5:	f7 f1                	div    %ecx
  801dd7:	89 c6                	mov    %eax,%esi
  801dd9:	89 e8                	mov    %ebp,%eax
  801ddb:	89 f7                	mov    %esi,%edi
  801ddd:	f7 f1                	div    %ecx
  801ddf:	89 fa                	mov    %edi,%edx
  801de1:	83 c4 1c             	add    $0x1c,%esp
  801de4:	5b                   	pop    %ebx
  801de5:	5e                   	pop    %esi
  801de6:	5f                   	pop    %edi
  801de7:	5d                   	pop    %ebp
  801de8:	c3                   	ret    
  801de9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801df0:	89 f9                	mov    %edi,%ecx
  801df2:	b8 20 00 00 00       	mov    $0x20,%eax
  801df7:	29 f8                	sub    %edi,%eax
  801df9:	d3 e2                	shl    %cl,%edx
  801dfb:	89 54 24 08          	mov    %edx,0x8(%esp)
  801dff:	89 c1                	mov    %eax,%ecx
  801e01:	89 da                	mov    %ebx,%edx
  801e03:	d3 ea                	shr    %cl,%edx
  801e05:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801e09:	09 d1                	or     %edx,%ecx
  801e0b:	89 f2                	mov    %esi,%edx
  801e0d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801e11:	89 f9                	mov    %edi,%ecx
  801e13:	d3 e3                	shl    %cl,%ebx
  801e15:	89 c1                	mov    %eax,%ecx
  801e17:	d3 ea                	shr    %cl,%edx
  801e19:	89 f9                	mov    %edi,%ecx
  801e1b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  801e1f:	89 eb                	mov    %ebp,%ebx
  801e21:	d3 e6                	shl    %cl,%esi
  801e23:	89 c1                	mov    %eax,%ecx
  801e25:	d3 eb                	shr    %cl,%ebx
  801e27:	09 de                	or     %ebx,%esi
  801e29:	89 f0                	mov    %esi,%eax
  801e2b:	f7 74 24 08          	divl   0x8(%esp)
  801e2f:	89 d6                	mov    %edx,%esi
  801e31:	89 c3                	mov    %eax,%ebx
  801e33:	f7 64 24 0c          	mull   0xc(%esp)
  801e37:	39 d6                	cmp    %edx,%esi
  801e39:	72 15                	jb     801e50 <__udivdi3+0x100>
  801e3b:	89 f9                	mov    %edi,%ecx
  801e3d:	d3 e5                	shl    %cl,%ebp
  801e3f:	39 c5                	cmp    %eax,%ebp
  801e41:	73 04                	jae    801e47 <__udivdi3+0xf7>
  801e43:	39 d6                	cmp    %edx,%esi
  801e45:	74 09                	je     801e50 <__udivdi3+0x100>
  801e47:	89 d8                	mov    %ebx,%eax
  801e49:	31 ff                	xor    %edi,%edi
  801e4b:	e9 40 ff ff ff       	jmp    801d90 <__udivdi3+0x40>
  801e50:	8d 43 ff             	lea    -0x1(%ebx),%eax
  801e53:	31 ff                	xor    %edi,%edi
  801e55:	e9 36 ff ff ff       	jmp    801d90 <__udivdi3+0x40>
  801e5a:	66 90                	xchg   %ax,%ax
  801e5c:	66 90                	xchg   %ax,%ax
  801e5e:	66 90                	xchg   %ax,%ax

00801e60 <__umoddi3>:
  801e60:	f3 0f 1e fb          	endbr32 
  801e64:	55                   	push   %ebp
  801e65:	57                   	push   %edi
  801e66:	56                   	push   %esi
  801e67:	53                   	push   %ebx
  801e68:	83 ec 1c             	sub    $0x1c,%esp
  801e6b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  801e6f:	8b 74 24 30          	mov    0x30(%esp),%esi
  801e73:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  801e77:	8b 7c 24 38          	mov    0x38(%esp),%edi
  801e7b:	85 c0                	test   %eax,%eax
  801e7d:	75 19                	jne    801e98 <__umoddi3+0x38>
  801e7f:	39 df                	cmp    %ebx,%edi
  801e81:	76 5d                	jbe    801ee0 <__umoddi3+0x80>
  801e83:	89 f0                	mov    %esi,%eax
  801e85:	89 da                	mov    %ebx,%edx
  801e87:	f7 f7                	div    %edi
  801e89:	89 d0                	mov    %edx,%eax
  801e8b:	31 d2                	xor    %edx,%edx
  801e8d:	83 c4 1c             	add    $0x1c,%esp
  801e90:	5b                   	pop    %ebx
  801e91:	5e                   	pop    %esi
  801e92:	5f                   	pop    %edi
  801e93:	5d                   	pop    %ebp
  801e94:	c3                   	ret    
  801e95:	8d 76 00             	lea    0x0(%esi),%esi
  801e98:	89 f2                	mov    %esi,%edx
  801e9a:	39 d8                	cmp    %ebx,%eax
  801e9c:	76 12                	jbe    801eb0 <__umoddi3+0x50>
  801e9e:	89 f0                	mov    %esi,%eax
  801ea0:	89 da                	mov    %ebx,%edx
  801ea2:	83 c4 1c             	add    $0x1c,%esp
  801ea5:	5b                   	pop    %ebx
  801ea6:	5e                   	pop    %esi
  801ea7:	5f                   	pop    %edi
  801ea8:	5d                   	pop    %ebp
  801ea9:	c3                   	ret    
  801eaa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801eb0:	0f bd e8             	bsr    %eax,%ebp
  801eb3:	83 f5 1f             	xor    $0x1f,%ebp
  801eb6:	75 50                	jne    801f08 <__umoddi3+0xa8>
  801eb8:	39 d8                	cmp    %ebx,%eax
  801eba:	0f 82 e0 00 00 00    	jb     801fa0 <__umoddi3+0x140>
  801ec0:	89 d9                	mov    %ebx,%ecx
  801ec2:	39 f7                	cmp    %esi,%edi
  801ec4:	0f 86 d6 00 00 00    	jbe    801fa0 <__umoddi3+0x140>
  801eca:	89 d0                	mov    %edx,%eax
  801ecc:	89 ca                	mov    %ecx,%edx
  801ece:	83 c4 1c             	add    $0x1c,%esp
  801ed1:	5b                   	pop    %ebx
  801ed2:	5e                   	pop    %esi
  801ed3:	5f                   	pop    %edi
  801ed4:	5d                   	pop    %ebp
  801ed5:	c3                   	ret    
  801ed6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801edd:	8d 76 00             	lea    0x0(%esi),%esi
  801ee0:	89 fd                	mov    %edi,%ebp
  801ee2:	85 ff                	test   %edi,%edi
  801ee4:	75 0b                	jne    801ef1 <__umoddi3+0x91>
  801ee6:	b8 01 00 00 00       	mov    $0x1,%eax
  801eeb:	31 d2                	xor    %edx,%edx
  801eed:	f7 f7                	div    %edi
  801eef:	89 c5                	mov    %eax,%ebp
  801ef1:	89 d8                	mov    %ebx,%eax
  801ef3:	31 d2                	xor    %edx,%edx
  801ef5:	f7 f5                	div    %ebp
  801ef7:	89 f0                	mov    %esi,%eax
  801ef9:	f7 f5                	div    %ebp
  801efb:	89 d0                	mov    %edx,%eax
  801efd:	31 d2                	xor    %edx,%edx
  801eff:	eb 8c                	jmp    801e8d <__umoddi3+0x2d>
  801f01:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f08:	89 e9                	mov    %ebp,%ecx
  801f0a:	ba 20 00 00 00       	mov    $0x20,%edx
  801f0f:	29 ea                	sub    %ebp,%edx
  801f11:	d3 e0                	shl    %cl,%eax
  801f13:	89 44 24 08          	mov    %eax,0x8(%esp)
  801f17:	89 d1                	mov    %edx,%ecx
  801f19:	89 f8                	mov    %edi,%eax
  801f1b:	d3 e8                	shr    %cl,%eax
  801f1d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801f21:	89 54 24 04          	mov    %edx,0x4(%esp)
  801f25:	8b 54 24 04          	mov    0x4(%esp),%edx
  801f29:	09 c1                	or     %eax,%ecx
  801f2b:	89 d8                	mov    %ebx,%eax
  801f2d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801f31:	89 e9                	mov    %ebp,%ecx
  801f33:	d3 e7                	shl    %cl,%edi
  801f35:	89 d1                	mov    %edx,%ecx
  801f37:	d3 e8                	shr    %cl,%eax
  801f39:	89 e9                	mov    %ebp,%ecx
  801f3b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  801f3f:	d3 e3                	shl    %cl,%ebx
  801f41:	89 c7                	mov    %eax,%edi
  801f43:	89 d1                	mov    %edx,%ecx
  801f45:	89 f0                	mov    %esi,%eax
  801f47:	d3 e8                	shr    %cl,%eax
  801f49:	89 e9                	mov    %ebp,%ecx
  801f4b:	89 fa                	mov    %edi,%edx
  801f4d:	d3 e6                	shl    %cl,%esi
  801f4f:	09 d8                	or     %ebx,%eax
  801f51:	f7 74 24 08          	divl   0x8(%esp)
  801f55:	89 d1                	mov    %edx,%ecx
  801f57:	89 f3                	mov    %esi,%ebx
  801f59:	f7 64 24 0c          	mull   0xc(%esp)
  801f5d:	89 c6                	mov    %eax,%esi
  801f5f:	89 d7                	mov    %edx,%edi
  801f61:	39 d1                	cmp    %edx,%ecx
  801f63:	72 06                	jb     801f6b <__umoddi3+0x10b>
  801f65:	75 10                	jne    801f77 <__umoddi3+0x117>
  801f67:	39 c3                	cmp    %eax,%ebx
  801f69:	73 0c                	jae    801f77 <__umoddi3+0x117>
  801f6b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  801f6f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  801f73:	89 d7                	mov    %edx,%edi
  801f75:	89 c6                	mov    %eax,%esi
  801f77:	89 ca                	mov    %ecx,%edx
  801f79:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  801f7e:	29 f3                	sub    %esi,%ebx
  801f80:	19 fa                	sbb    %edi,%edx
  801f82:	89 d0                	mov    %edx,%eax
  801f84:	d3 e0                	shl    %cl,%eax
  801f86:	89 e9                	mov    %ebp,%ecx
  801f88:	d3 eb                	shr    %cl,%ebx
  801f8a:	d3 ea                	shr    %cl,%edx
  801f8c:	09 d8                	or     %ebx,%eax
  801f8e:	83 c4 1c             	add    $0x1c,%esp
  801f91:	5b                   	pop    %ebx
  801f92:	5e                   	pop    %esi
  801f93:	5f                   	pop    %edi
  801f94:	5d                   	pop    %ebp
  801f95:	c3                   	ret    
  801f96:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f9d:	8d 76 00             	lea    0x0(%esi),%esi
  801fa0:	29 fe                	sub    %edi,%esi
  801fa2:	19 c3                	sbb    %eax,%ebx
  801fa4:	89 f2                	mov    %esi,%edx
  801fa6:	89 d9                	mov    %ebx,%ecx
  801fa8:	e9 1d ff ff ff       	jmp    801eca <__umoddi3+0x6a>
